Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -7,6 +7,10 @@ from sklearn.model_selection import train_test_split
|
|
7 |
from sklearn.datasets import fetch_california_housing
|
8 |
import pickle
|
9 |
|
|
|
|
|
|
|
|
|
10 |
# Load the data
|
11 |
california = fetch_california_housing()
|
12 |
df = pd.DataFrame(california.data, columns=california.feature_names)
|
@@ -52,7 +56,9 @@ model.fit(X_train, y_train)
|
|
52 |
y_pred = model.predict(X_test)
|
53 |
|
54 |
# Evaluating the model
|
55 |
-
|
|
|
|
|
56 |
|
57 |
|
58 |
|
|
|
7 |
from sklearn.datasets import fetch_california_housing
|
8 |
import pickle
|
9 |
|
10 |
+
from sklearn import datasets
|
11 |
+
|
12 |
+
from sklearn.metrics import mean_squared_error, r2_score
|
13 |
+
|
14 |
# Load the data
|
15 |
california = fetch_california_housing()
|
16 |
df = pd.DataFrame(california.data, columns=california.feature_names)
|
|
|
56 |
y_pred = model.predict(X_test)
|
57 |
|
58 |
# Evaluating the model
|
59 |
+
mse = mean_squared_error(y_test, y_pred)
|
60 |
+
rmse = np.sqrt(mse)
|
61 |
+
r2 = r2_score(y_test, y_pred)
|
62 |
|
63 |
|
64 |
|