Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -59,7 +59,7 @@ def train_models(input_data, outliers_fraction, n_samples, clf_name):
|
|
| 59 |
t1 = time.time()
|
| 60 |
|
| 61 |
# Plot
|
| 62 |
-
plt.figure(figsize=(
|
| 63 |
if clf_name != "Local Outlier Factor":
|
| 64 |
Z = clf.predict(np.c_[xx.ravel(), yy.ravel()])
|
| 65 |
Z = Z.reshape(xx.shape)
|
|
@@ -91,12 +91,12 @@ with gr.Blocks() as demo:
|
|
| 91 |
n_samples = gr.Slider(minimum=100, maximum=500, step=25, value=300, label="Number of Samples")
|
| 92 |
outliers_fraction = gr.Slider(minimum=0.1, maximum=0.9, step=0.1, value=0.2, label="Fraction of Outliers")
|
| 93 |
|
| 94 |
-
# Models and their plots
|
| 95 |
input_models = ["Robust covariance", "One-Class SVM", "One-Class SVM (SGD)", "Isolation Forest", "Local Outlier Factor"]
|
| 96 |
plots = []
|
| 97 |
|
| 98 |
-
|
| 99 |
-
|
| 100 |
plot = gr.Plot(label=model_name)
|
| 101 |
plots.append((model_name, plot))
|
| 102 |
|
|
|
|
| 59 |
t1 = time.time()
|
| 60 |
|
| 61 |
# Plot
|
| 62 |
+
plt.figure(figsize=(5, 5))
|
| 63 |
if clf_name != "Local Outlier Factor":
|
| 64 |
Z = clf.predict(np.c_[xx.ravel(), yy.ravel()])
|
| 65 |
Z = Z.reshape(xx.shape)
|
|
|
|
| 91 |
n_samples = gr.Slider(minimum=100, maximum=500, step=25, value=300, label="Number of Samples")
|
| 92 |
outliers_fraction = gr.Slider(minimum=0.1, maximum=0.9, step=0.1, value=0.2, label="Fraction of Outliers")
|
| 93 |
|
| 94 |
+
# Models and their plots in a row
|
| 95 |
input_models = ["Robust covariance", "One-Class SVM", "One-Class SVM (SGD)", "Isolation Forest", "Local Outlier Factor"]
|
| 96 |
plots = []
|
| 97 |
|
| 98 |
+
with gr.Row():
|
| 99 |
+
for model_name in input_models:
|
| 100 |
plot = gr.Plot(label=model_name)
|
| 101 |
plots.append((model_name, plot))
|
| 102 |
|