Spaces:
Running
Running
Commit
·
860e9cd
1
Parent(s):
c7ed491
adjustments
Browse files- app.py +5 -21
- gradio_queue.db +0 -0
app.py
CHANGED
@@ -2,19 +2,7 @@ import numpy as np
|
|
2 |
import matplotlib.pyplot as plt
|
3 |
from threading import Thread
|
4 |
from matplotlib.colors import ListedColormap
|
5 |
-
from sklearn.model_selection import train_test_split
|
6 |
-
from sklearn.preprocessing import StandardScaler
|
7 |
from sklearn.datasets import make_moons, make_circles, make_classification
|
8 |
-
from sklearn.neural_network import MLPClassifier
|
9 |
-
from sklearn.neighbors import KNeighborsClassifier
|
10 |
-
from sklearn.svm import SVC
|
11 |
-
from sklearn.gaussian_process import GaussianProcessClassifier
|
12 |
-
from sklearn.gaussian_process.kernels import RBF
|
13 |
-
from sklearn.tree import DecisionTreeClassifier
|
14 |
-
from sklearn.ensemble import RandomForestClassifier, AdaBoostClassifier
|
15 |
-
from sklearn.naive_bayes import GaussianNB
|
16 |
-
from sklearn.discriminant_analysis import QuadraticDiscriminantAnalysis
|
17 |
-
from sklearn.inspection import DecisionBoundaryDisplay
|
18 |
from sklearn.datasets import make_blobs, make_circles, make_moons
|
19 |
import gradio as gr
|
20 |
import math
|
@@ -33,10 +21,6 @@ from sklearn.kernel_approximation import Nystroem
|
|
33 |
from sklearn.pipeline import make_pipeline
|
34 |
|
35 |
|
36 |
-
### DATASETS
|
37 |
-
|
38 |
-
def normalize(X):
|
39 |
-
return StandardScaler().fit_transform(X)
|
40 |
|
41 |
# Example settings
|
42 |
n_samples = 300
|
@@ -108,7 +92,7 @@ DATASETS = [
|
|
108 |
###########
|
109 |
|
110 |
#### PLOT
|
111 |
-
FIGSIZE =
|
112 |
figure = plt.figure(figsize=(25, 10))
|
113 |
i = 1
|
114 |
|
@@ -136,13 +120,13 @@ def train_models(selected_data, clf_name):
|
|
136 |
y_pred = clf.fit(X).predict(X)
|
137 |
|
138 |
# plot the levels lines and the points
|
139 |
-
if clf_name != "Local Outlier Factor":
|
140 |
Z = clf.predict(np.c_[xx.ravel(), yy.ravel()])
|
141 |
Z = Z.reshape(xx.shape)
|
142 |
-
plt.contour(xx, yy, Z, levels=[0], linewidths=
|
143 |
|
144 |
colors = np.array(["#377eb8", "#ff7f00"])
|
145 |
-
plt.scatter(X[:, 0], X[:, 1], s=
|
146 |
|
147 |
plt.xlim(-7, 7)
|
148 |
plt.ylim(-7, 7)
|
@@ -153,7 +137,7 @@ def train_models(selected_data, clf_name):
|
|
153 |
0.01,
|
154 |
("%.2fs" % (t1 - t0)).lstrip("0"),
|
155 |
transform=plt.gca().transAxes,
|
156 |
-
size=
|
157 |
horizontalalignment="right",
|
158 |
)
|
159 |
plot_num += 1
|
|
|
2 |
import matplotlib.pyplot as plt
|
3 |
from threading import Thread
|
4 |
from matplotlib.colors import ListedColormap
|
|
|
|
|
5 |
from sklearn.datasets import make_moons, make_circles, make_classification
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
from sklearn.datasets import make_blobs, make_circles, make_moons
|
7 |
import gradio as gr
|
8 |
import math
|
|
|
21 |
from sklearn.pipeline import make_pipeline
|
22 |
|
23 |
|
|
|
|
|
|
|
|
|
24 |
|
25 |
# Example settings
|
26 |
n_samples = 300
|
|
|
92 |
###########
|
93 |
|
94 |
#### PLOT
|
95 |
+
FIGSIZE = 10,10
|
96 |
figure = plt.figure(figsize=(25, 10))
|
97 |
i = 1
|
98 |
|
|
|
120 |
y_pred = clf.fit(X).predict(X)
|
121 |
|
122 |
# plot the levels lines and the points
|
123 |
+
if clf_name != "Local Outlier Factor":
|
124 |
Z = clf.predict(np.c_[xx.ravel(), yy.ravel()])
|
125 |
Z = Z.reshape(xx.shape)
|
126 |
+
plt.contour(xx, yy, Z, levels=[0], linewidths=10, colors="black")
|
127 |
|
128 |
colors = np.array(["#377eb8", "#ff7f00"])
|
129 |
+
plt.scatter(X[:, 0], X[:, 1], s=100, color=colors[(y_pred + 1) // 2])
|
130 |
|
131 |
plt.xlim(-7, 7)
|
132 |
plt.ylim(-7, 7)
|
|
|
137 |
0.01,
|
138 |
("%.2fs" % (t1 - t0)).lstrip("0"),
|
139 |
transform=plt.gca().transAxes,
|
140 |
+
size=60,
|
141 |
horizontalalignment="right",
|
142 |
)
|
143 |
plot_num += 1
|
gradio_queue.db
DELETED
Binary file (340 kB)
|
|