diff --git a/api.py b/api.py index f822fbe2..6be527b9 100644 --- a/api.py +++ b/api.py @@ -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') diff --git a/assets/trained-models/Random_Forest_Reg_Model.pkl b/assets/trained-models/Random_Forest_Reg_Model.pkl new file mode 100644 index 00000000..e69de29b diff --git a/assets/trained-models/es5_rfr_model.pkl b/assets/trained-models/es5_rfr_model.pkl new file mode 100644 index 00000000..e69de29b diff --git a/model.py b/model.py index 42f73063..79aa858c 100644 --- a/model.py +++ b/model.py @@ -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 @@ -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