ankitajain commited on
Commit
cdc4b33
·
1 Parent(s): 7b56708
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -15,7 +15,7 @@ K = st.slider(
15
  )
16
 
17
 
18
- X, y = make_regression(n_samples=1000, n_features=1, random_state=42)
19
 
20
  ntrain = 700
21
 
@@ -28,12 +28,14 @@ knn = KNeighborsRegressor(n_neighbors=K)
28
  knn.fit(x_train, y_train)
29
  plt.figure()
30
  y_pred = knn.predict(x_test)
31
- plt.scatter(x_test, y_test)
32
- plt.plot(x_test, y_pred)
 
 
33
 
34
  with st_col:
35
  st.pyplot(plt)
36
- error = mean_squared_error(y_test, y_pred)
37
  st.write("The error is", error)
38
 
39
  hide_streamlit_style = """
 
15
  )
16
 
17
 
18
+ X, y = make_regression(n_samples=1000, n_features=1,random_state=42)
19
 
20
  ntrain = 700
21
 
 
28
  knn.fit(x_train, y_train)
29
  plt.figure()
30
  y_pred = knn.predict(x_test)
31
+ plt.scatter(x_test,y_test)
32
+ plt.plot(x_test,y_pred)
33
+ plt.xlabel("Datapoints")
34
+ plt.ylabel("Predictions")
35
 
36
  with st_col:
37
  st.pyplot(plt)
38
+ error = mean_squared_error(y_test,y_pred)
39
  st.write("The error is", error)
40
 
41
  hide_streamlit_style = """