Spaces:
Sleeping
Sleeping
Shafeek Saleem
commited on
Commit
·
b14d8eb
1
Parent(s):
9fdbc31
ss
Browse files
pages/3_Training the Model.py
CHANGED
@@ -54,12 +54,15 @@ def create_model_inputs(data, lag, mean_period, target_variable):
|
|
54 |
X = df_processed[
|
55 |
["Location", "MinTemp", "MaxTemp", "Rainfall", "WindGustDir", "WindGustSpeed", "WindDir9am", "WindDir3pm",
|
56 |
"WindSpeed9am", "WindSpeed3pm", "Humidity9am", "Humidity3pm", "Pressure9am", "Pressure3pm", "Temp9am",
|
57 |
-
"Temp3pm", "RainToday", target_variable + "_mean"]]
|
58 |
from sklearn.preprocessing import LabelEncoder
|
59 |
label_encoder = LabelEncoder()
|
60 |
X['RainToday'] = label_encoder.fit_transform(X['RainToday'])
|
61 |
-
|
62 |
-
X =
|
|
|
|
|
|
|
63 |
y = df_processed[target_variable + "Tomorrow"].loc[X.index]
|
64 |
|
65 |
return X, y, target_variable + "Tomorrow"
|
|
|
54 |
X = df_processed[
|
55 |
["Location", "MinTemp", "MaxTemp", "Rainfall", "WindGustDir", "WindGustSpeed", "WindDir9am", "WindDir3pm",
|
56 |
"WindSpeed9am", "WindSpeed3pm", "Humidity9am", "Humidity3pm", "Pressure9am", "Pressure3pm", "Temp9am",
|
57 |
+
"Temp3pm", "RainToday", target_variable + "_mean"]].dropNa()
|
58 |
from sklearn.preprocessing import LabelEncoder
|
59 |
label_encoder = LabelEncoder()
|
60 |
X['RainToday'] = label_encoder.fit_transform(X['RainToday'])
|
61 |
+
X['Location'] = label_encoder.fit_transform(X['Location'])
|
62 |
+
X['WindGustDir'] = label_encoder.fit_transform(X['WindGustDir'])
|
63 |
+
X['WindDir9am'] = label_encoder.fit_transform(X['WindDir9am'])
|
64 |
+
X['WindDir3pm'] = label_encoder.fit_transform(X['WindDir3pm'])
|
65 |
+
# X = pd.get_dummies(X, columns=['Location', 'WindGustDir', 'WindDir9am', 'WindDir3pm'])
|
66 |
y = df_processed[target_variable + "Tomorrow"].loc[X.index]
|
67 |
|
68 |
return X, y, target_variable + "Tomorrow"
|