Shafeek Saleem commited on
Commit
66b198b
·
1 Parent(s): bbdc057
Files changed (1) hide show
  1. pages/3_Training the Model.py +10 -7
pages/3_Training the Model.py CHANGED
@@ -55,6 +55,10 @@ def create_model_inputs(data, lag, mean_period, target_variable):
55
  ["Location", "MinTemp", "MaxTemp", "Rainfall", "WindGustDir", "WindGustSpeed", "WindDir9am", "WindDir3pm",
56
  "WindSpeed9am", "WindSpeed3pm", "Humidity9am", "Humidity3pm", "Pressure9am", "Pressure3pm", "Temp9am",
57
  "Temp3pm", "RainToday", target_variable + "_mean"]]
 
 
 
 
58
  X = pd.get_dummies(X, columns=['Location', 'WindGustDir', 'WindDir9am', 'WindDir3pm'])
59
  y = df_processed[target_variable + "Tomorrow"].loc[X.index]
60
 
@@ -161,13 +165,12 @@ def step3_page():
161
  st.subheader("Step 2: Data Preprocessing and Feature Engineering")
162
  st.write("Now let's preprocess our dataset to handle missing values, outliers and inconsistencies and then perform feature engineering tasks to extract meaningful features from the raw data. Finally we need to separate training variables (X) and target variable (y).")
163
  st.info("You can select the weather attribute that you want to forecast (WindSpeed/ Humidity/ Pressure/ Temperature) and the time of the forecast (9am tomorrow/ 3pm tomorrow)")
164
- cols = st.columns(2)
165
- with cols[0]:
166
- attributes = ['WindSpeed', 'Humidity', 'Pressure', 'Temp']
167
- attribute = st.selectbox('Select the Weather Attribute', attributes)
168
- with cols[1]:
169
- times = ['9am', '3pm']
170
- time = st.selectbox('Select the Time of the Forecast for Tomorrow', times)
171
  target_variable = attribute+time
172
  X, y, target_variable_name = create_model_inputs(data, 1, 30, target_variable)
173
  cols = st.columns(2)
 
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 = pd.get_dummies(X, columns=['Location', 'WindGustDir', 'WindDir9am', 'WindDir3pm'])
63
  y = df_processed[target_variable + "Tomorrow"].loc[X.index]
64
 
 
165
  st.subheader("Step 2: Data Preprocessing and Feature Engineering")
166
  st.write("Now let's preprocess our dataset to handle missing values, outliers and inconsistencies and then perform feature engineering tasks to extract meaningful features from the raw data. Finally we need to separate training variables (X) and target variable (y).")
167
  st.info("You can select the weather attribute that you want to forecast (WindSpeed/ Humidity/ Pressure/ Temperature) and the time of the forecast (9am tomorrow/ 3pm tomorrow)")
168
+
169
+ attributes = ['WindSpeed', 'Humidity', 'Pressure', 'Temp']
170
+ attribute = st.selectbox('Select the Weather Attribute', attributes)
171
+
172
+ times = ['9am', '3pm']
173
+ time = st.selectbox('Select the Time of the Forecast for Tomorrow', times)
 
174
  target_variable = attribute+time
175
  X, y, target_variable_name = create_model_inputs(data, 1, 30, target_variable)
176
  cols = st.columns(2)