Spaces:
Runtime error
Runtime error
Commit
•
04125fd
1
Parent(s):
c719018
commit
Browse files
app.py
CHANGED
@@ -34,24 +34,16 @@ else:
|
|
34 |
|
35 |
knn = KNeighborsRegressor(n_neighbors=K, metric=metric)
|
36 |
knn.fit(x_train, y_train)
|
37 |
-
|
38 |
|
39 |
plt.figure()
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
xx = np.meshgrid(x)
|
44 |
-
xy = np.c_[np.array(xx).ravel()]
|
45 |
-
y_pred = knn.predict(xy)
|
46 |
-
|
47 |
-
#plt.pcolormesh(y_pred, cmap='jet', alpha=0.2)
|
48 |
-
|
49 |
-
#plt.plot(y_test[:30], "C0s", label="True Points (Test)")
|
50 |
plt.plot(y_pred[:30], "C1*", label="Predictions (Test)")
|
51 |
plt.xlabel("X")
|
52 |
plt.ylabel("Y")
|
53 |
plt.legend(loc="upper left")
|
54 |
-
|
55 |
|
56 |
sns.despine(right=True, top=True)
|
57 |
|
|
|
34 |
|
35 |
knn = KNeighborsRegressor(n_neighbors=K, metric=metric)
|
36 |
knn.fit(x_train, y_train)
|
37 |
+
y_pred = knn.predict(x_test)
|
38 |
|
39 |
plt.figure()
|
40 |
|
41 |
+
plt.plot(y_test[:30], "C0s", label="True Points (Test)")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
plt.plot(y_pred[:30], "C1*", label="Predictions (Test)")
|
43 |
plt.xlabel("X")
|
44 |
plt.ylabel("Y")
|
45 |
plt.legend(loc="upper left")
|
46 |
+
plt.ylim(-90,90)
|
47 |
|
48 |
sns.despine(right=True, top=True)
|
49 |
|