Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,6 +10,18 @@ from sklearn.naive_bayes import GaussianNB
|
|
| 10 |
|
| 11 |
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
def plot_figure(N, u1, std1, u2, std2, show_dist, classifier=None):
|
| 14 |
#N = 100
|
| 15 |
import numpy as np
|
|
@@ -116,6 +128,7 @@ def plot_figure(N, u1, std1, u2, std2, show_dist, classifier=None):
|
|
| 116 |
return 'plot.png', pd_all
|
| 117 |
|
| 118 |
|
|
|
|
| 119 |
# 1. define mean and standard deviation for class 1
|
| 120 |
|
| 121 |
set_mean_class1 = gr.inputs.Slider(-20, 20, step=0.5, default=1, label = 'Mean (Class 1)')
|
|
|
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
+
def gaussian(x, n, u, s):
|
| 14 |
+
#u = x.mean()
|
| 15 |
+
#s = x.std()
|
| 16 |
+
|
| 17 |
+
# divide [x.min(), x.max()] by n
|
| 18 |
+
x = np.linspace(x.min(), x.max(), n)
|
| 19 |
+
|
| 20 |
+
a = ((x - u) ** 2) / (2 * (s ** 2))
|
| 21 |
+
y = 1 / (s * np.sqrt(2 * np.pi)) * np.exp(-a)
|
| 22 |
+
|
| 23 |
+
return x, y, u, s
|
| 24 |
+
|
| 25 |
def plot_figure(N, u1, std1, u2, std2, show_dist, classifier=None):
|
| 26 |
#N = 100
|
| 27 |
import numpy as np
|
|
|
|
| 128 |
return 'plot.png', pd_all
|
| 129 |
|
| 130 |
|
| 131 |
+
|
| 132 |
# 1. define mean and standard deviation for class 1
|
| 133 |
|
| 134 |
set_mean_class1 = gr.inputs.Slider(-20, 20, step=0.5, default=1, label = 'Mean (Class 1)')
|