Spaces:
Sleeping
Sleeping
Shafeek Saleem
commited on
Commit
·
8b28803
1
Parent(s):
bfa7dd5
ss
Browse files
pages/3_Training the Model.py
CHANGED
@@ -64,7 +64,7 @@ def create_model_inputs(data, lag, mean_period, target_variable):
|
|
64 |
X['WindDir3pm'] = label_encoder.fit_transform(X['WindDir3pm'])
|
65 |
X.drop(X.index[-1], inplace=True)
|
66 |
# X = pd.get_dummies(X, columns=['Location', 'WindGustDir', 'WindDir9am', 'WindDir3pm'])
|
67 |
-
y = df_processed[target_variable + "Tomorrow"].loc[X.index]
|
68 |
|
69 |
return X, y, target_variable + "Tomorrow"
|
70 |
|
@@ -72,8 +72,8 @@ def create_model_inputs(data, lag, mean_period, target_variable):
|
|
72 |
def show_output(y_test, y_pred, target_variable_name):
|
73 |
st.subheader("Model Performance")
|
74 |
st.write(f"Test R2 score: {r2_score(y_test, y_pred):.2f}")
|
75 |
-
y_test = pd.DataFrame(y_test)
|
76 |
-
y_pred = pd.DataFrame(y_pred)
|
77 |
fig, axs = plt.subplots(3, figsize=(12, 18))
|
78 |
axs[0].plot(y_test.index, y_pred, label='Predicted')
|
79 |
axs[0].plot(y_test.index, y_test[target_variable_name], label='Actual')
|
|
|
64 |
X['WindDir3pm'] = label_encoder.fit_transform(X['WindDir3pm'])
|
65 |
X.drop(X.index[-1], inplace=True)
|
66 |
# X = pd.get_dummies(X, columns=['Location', 'WindGustDir', 'WindDir9am', 'WindDir3pm'])
|
67 |
+
y = df_processed[[target_variable + "Tomorrow"]].loc[X.index]
|
68 |
|
69 |
return X, y, target_variable + "Tomorrow"
|
70 |
|
|
|
72 |
def show_output(y_test, y_pred, target_variable_name):
|
73 |
st.subheader("Model Performance")
|
74 |
st.write(f"Test R2 score: {r2_score(y_test, y_pred):.2f}")
|
75 |
+
# y_test = pd.DataFrame(y_test)
|
76 |
+
# y_pred = pd.DataFrame(y_pred)
|
77 |
fig, axs = plt.subplots(3, figsize=(12, 18))
|
78 |
axs[0].plot(y_test.index, y_pred, label='Predicted')
|
79 |
axs[0].plot(y_test.index, y_test[target_variable_name], label='Actual')
|