Update app.py
Browse files
app.py
CHANGED
|
@@ -83,7 +83,7 @@ def gradient_descent(intercept=4, slope=3, intercept_random=4, slope_random=3, g
|
|
| 83 |
X_tmp = np.array([[0], [2]])
|
| 84 |
X_tmp_b = np.c_[np.ones((2, 1)), X_tmp] # add x0 = 1 to each instance
|
| 85 |
y_predict_tmp = X_tmp_b.dot(np.array([b, w]))
|
| 86 |
-
plt.plot(X_tmp, y_predict_tmp, "
|
| 87 |
|
| 88 |
if i == int(iteration/3):
|
| 89 |
X_tmp = np.array([[0], [2]])
|
|
@@ -208,7 +208,7 @@ interface = gr.Interface(fn=gradient_descent,
|
|
| 208 |
outputs=[output_plot1],
|
| 209 |
examples_per_page = 2,
|
| 210 |
examples = [[4, 3, -7, -5, True, 0.0001, 100], [1, 2, -7, -8, False, 0.0001, 100]],
|
| 211 |
-
title="CSCI4750/5750: Regression models (Function approximation by Gradient Descent)",
|
| 212 |
description= "Click examples to generate random dataset and select gradient descent parameters",
|
| 213 |
theme = 'huggingface',
|
| 214 |
layout = 'vertical'
|
|
|
|
| 83 |
X_tmp = np.array([[0], [2]])
|
| 84 |
X_tmp_b = np.c_[np.ones((2, 1)), X_tmp] # add x0 = 1 to each instance
|
| 85 |
y_predict_tmp = X_tmp_b.dot(np.array([b, w]))
|
| 86 |
+
plt.plot(X_tmp, y_predict_tmp, "brown", linewidth=2, label = "Fitted line in iteration "+str(i))
|
| 87 |
|
| 88 |
if i == int(iteration/3):
|
| 89 |
X_tmp = np.array([[0], [2]])
|
|
|
|
| 208 |
outputs=[output_plot1],
|
| 209 |
examples_per_page = 2,
|
| 210 |
examples = [[4, 3, -7, -5, True, 0.0001, 100], [1, 2, -7, -8, False, 0.0001, 100]],
|
| 211 |
+
title="CSCI4750/5750: Regression models \n (Function approximation by Gradient Descent)",
|
| 212 |
description= "Click examples to generate random dataset and select gradient descent parameters",
|
| 213 |
theme = 'huggingface',
|
| 214 |
layout = 'vertical'
|