Skip to content
This repository was archived by the owner on Nov 23, 2023. It is now read-only.

Model changes #51

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
# Load our model into memory.
# Please update this path to reflect your own trained model.
static_model = load_model(
path_to_model='assets/trained-models/load_shortfall_simple_lm_regression.pkl')
path_to_model='assets/trained-models/Random_Forest_Reg_Model.pkl')

print ('-'*40)
print ('Model successfully loaded')
Expand Down
Empty file.
Empty file.
17 changes: 16 additions & 1 deletion model.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,21 @@ def _preprocess_data(data):
feature_vector_dict = json.loads(data)
# Load the dictionary as a Pandas DataFrame.
feature_vector_df = pd.DataFrame.from_dict([feature_vector_dict])
new_features = ['Unnamed: 0', 'Madrid_wind_speed', 'Bilbao_rain_1h',
'Valencia_wind_speed', 'Seville_humidity', 'Madrid_humidity',
'Bilbao_clouds_all', 'Bilbao_wind_speed', 'Seville_clouds_all',
'Bilbao_wind_deg', 'Barcelona_wind_speed', 'Barcelona_wind_deg',
'Madrid_clouds_all', 'Seville_wind_speed', 'Barcelona_rain_1h',
'Seville_rain_1h', 'Bilbao_snow_3h', 'Barcelona_pressure',
'Seville_rain_3h', 'Madrid_rain_1h', 'Barcelona_rain_3h',
'Valencia_snow_3h', 'Madrid_weather_id', 'Barcelona_weather_id',
'Bilbao_pressure', 'Seville_weather_id', 'Seville_temp_max',
'Madrid_pressure', 'Valencia_temp_max', 'Valencia_temp',
'Bilbao_weather_id', 'Seville_temp', 'Valencia_humidity',
'Valencia_temp_min', 'Barcelona_temp_max', 'Madrid_temp_max',
'Barcelona_temp', 'Bilbao_temp_min', 'Bilbao_temp',
'Barcelona_temp_min', 'Bilbao_temp_max', 'Seville_temp_min',
'Madrid_temp', 'Madrid_temp_min']

# ---------------------------------------------------------------
# NOTE: You will need to swap the lines below for your own data
Expand All @@ -58,7 +73,7 @@ def _preprocess_data(data):
# ---------------------------------------------------------------

# ----------- Replace this code with your own preprocessing steps --------
predict_vector = feature_vector_df[['Madrid_wind_speed','Bilbao_rain_1h','Valencia_wind_speed']]
predict_vector = feature_vector_df[new_features]
# ------------------------------------------------------------------------

return predict_vector
Expand Down