Update app.py
Browse files
app.py
CHANGED
|
@@ -20,10 +20,6 @@ from sklearn.linear_model import SGDOneClassSVM
|
|
| 20 |
from sklearn.kernel_approximation import Nystroem
|
| 21 |
from sklearn.pipeline import make_pipeline
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
#### MODELS
|
| 26 |
-
|
| 27 |
def get_groundtruth_model(X, labels):
|
| 28 |
# dummy model to show true label distribution
|
| 29 |
class Dummy:
|
|
@@ -31,24 +27,13 @@ def get_groundtruth_model(X, labels):
|
|
| 31 |
self.labels_ = labels
|
| 32 |
|
| 33 |
return Dummy(labels)
|
| 34 |
-
############
|
| 35 |
-
# Define datasets
|
| 36 |
-
# Example settings
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
|
| 41 |
#### PLOT
|
| 42 |
FIGSIZE = 10,10
|
| 43 |
figure = plt.figure(figsize=(25, 10))
|
| 44 |
-
i = 1
|
| 45 |
-
|
| 46 |
-
|
| 47 |
|
| 48 |
|
| 49 |
def train_models(input_data, outliers_fraction, n_samples, clf_name):
|
| 50 |
-
# n_samples=300
|
| 51 |
-
# outliers_fraction = 0.15
|
| 52 |
n_outliers = int(outliers_fraction * n_samples)
|
| 53 |
n_inliers = n_samples - n_outliers
|
| 54 |
blobs_params = dict(random_state=0, n_samples=n_inliers, n_features=2)
|
|
@@ -134,8 +119,6 @@ def train_models(input_data, outliers_fraction, n_samples, clf_name):
|
|
| 134 |
|
| 135 |
return plt
|
| 136 |
|
| 137 |
-
|
| 138 |
-
|
| 139 |
description = "Learn how different anomaly detection algorithms perform in different datasets."
|
| 140 |
|
| 141 |
def iter_grid(n_rows, n_cols):
|
|
|
|
| 20 |
from sklearn.kernel_approximation import Nystroem
|
| 21 |
from sklearn.pipeline import make_pipeline
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
def get_groundtruth_model(X, labels):
|
| 24 |
# dummy model to show true label distribution
|
| 25 |
class Dummy:
|
|
|
|
| 27 |
self.labels_ = labels
|
| 28 |
|
| 29 |
return Dummy(labels)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
#### PLOT
|
| 32 |
FIGSIZE = 10,10
|
| 33 |
figure = plt.figure(figsize=(25, 10))
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
|
| 36 |
def train_models(input_data, outliers_fraction, n_samples, clf_name):
|
|
|
|
|
|
|
| 37 |
n_outliers = int(outliers_fraction * n_samples)
|
| 38 |
n_inliers = n_samples - n_outliers
|
| 39 |
blobs_params = dict(random_state=0, n_samples=n_inliers, n_features=2)
|
|
|
|
| 119 |
|
| 120 |
return plt
|
| 121 |
|
|
|
|
|
|
|
| 122 |
description = "Learn how different anomaly detection algorithms perform in different datasets."
|
| 123 |
|
| 124 |
def iter_grid(n_rows, n_cols):
|