-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpredicting_climate_in_london.py
280 lines (196 loc) · 25.2 KB
/
predicting_climate_in_london.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# -*- coding: utf-8 -*-
"""Predicting_Climate_in_London (1).ipynb
Automatically generated by Colab.
Original file is located at
https://colab.research.google.com/drive/1jd70zjONVSY28o-cVGgBtrE7TAoZpr_V
"""
!python --version
"""![pic.jpg](data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAgICAgJCAkKCgkNDgwODRMREBARExwUFhQWFBwrGx8bGx8bKyYuJSMlLiZENS8vNUROQj5CTl9VVV93cXecnNEBCAgICAkICQoKCQ0ODA4NExEQEBETHBQWFBYUHCsbHxsbHxsrJi4lIyUuJkQ1Ly81RE5CPkJOX1VVX3dxd5yc0f/CABEIAL8BLAMBIgACEQEDEQH/xAAzAAABBQEBAAAAAAAAAAAAAAAFAQIDBAY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BwZtv7RioLgUeIFB+yIMaf0rGqD5TiJCIVG2+4IjilNQmwYvtHsIubZajvPfAdB9TPfN3YAfdowtuP8zV8Z//2Q==)
As the climate changes, predicting the weather becomes ever more important for businesses. The aim of of this machine learning project is building a pipeline to predict the climate in London, England. Specifically, the model will predict mean temperature in degrees Celsius (°C).
Since the weather depends on a lot of different factors, different experiments will be run to determine what the best approach is to predict the weather. In this project, experiments will be run for different regression models predicting the mean temperature, using a combination of `sklearn` and `mlflow`.
You will be working with data stored in `london_weather.csv`, which contains the following columns:
- **date** - recorded date of measurement - (**int**)
- **cloud_cover** - cloud cover measurement in oktas - (**float**)
- **sunshine** - sunshine measurement in hours (hrs) - (**float**)
- **global_radiation** - irradiance measurement in Watt per square meter (W/m2) - (**float**)
- **max_temp** - maximum temperature recorded in degrees Celsius (°C) - (**float**)
- **mean_temp** - **target** mean temperature in degrees Celsius (°C) - (**float**)
- **min_temp** - minimum temperature recorded in degrees Celsius (°C) - (**float**)
- **precipitation** - precipitation measurement in millimeters (mm) - (**float**)
- **pressure** - pressure measurement in Pascals (Pa) - (**float**)
- **snow_depth** - snow depth measurement in centimeters (cm) - (**float**)
"""
from google.colab import drive
drive.mount('/content/drive')
# Run this cell to install mlflow
!pip install -q mlflow
# Run this cell to import the modules you require
import pandas as pd
import numpy as np
import mlflow
import mlflow.sklearn
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.model_selection import train_test_split
from sklearn.pipeline import make_pipeline
from sklearn.metrics import mean_squared_error
from sklearn.impute import SimpleImputer
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LinearRegression
from sklearn.tree import DecisionTreeRegressor
from sklearn.ensemble import RandomForestRegressor
mlflow.__version__
#load data
data = pd.read_csv('/content/drive/MyDrive/london_weather.csv')
df = data.copy()
df.head()
#Determine the column names, data types, number of non-null vales
df.info()
"""## Data Cleaning"""
df['date'] = pd.to_datetime(df['date'], format="%Y%m%d")
df['year'] = df['date'].dt.year
df['month'] = df['date'].dt.month
df['day'] = df['date'].dt.day
"""## EDA"""
# @title Distribution of Cloud Cover
df['cloud_cover'].plot(kind='hist', bins=20, title='Cloud Cover')
plt.gca().spines[['top', 'right',]].set_visible(False)
# @title Distribution of Sunshine
df['sunshine'].plot(kind='hist', bins=20, title='Sunshine')
plt.gca().spines[['top', 'right',]].set_visible(False)
# @title Distribution of Global Radiation
df['global_radiation'].plot(kind='hist', bins=20, title='Global Radiation')
plt.gca().spines[['top', 'right',]].set_visible(False)
# @title Distribution of Maximum Temperature
df['max_temp'].plot(kind='hist', bins=20, title='Maximum Temperature')
plt.gca().spines[['top', 'right',]].set_visible(False)
# @title Scatterplot of Global Radiation vs Sunshine
df.plot(kind='scatter', x='sunshine', y='global_radiation', s=32, alpha=.8)
plt.gca().spines[['top', 'right',]].set_visible(False)
# @title Scatterplot of Maximum Temperature vs Global Radiation
df.plot(kind='scatter', x='global_radiation', y='max_temp', s=32, alpha=.8)
plt.gca().spines[['top', 'right',]].set_visible(False)
# @title Scatterplot of Mean Temperature vs Maximum Temperature
df.plot(kind='scatter', x='max_temp', y='mean_temp', s=32, alpha=.8)
plt.gca().spines[['top', 'right',]].set_visible(False)
#visualize "mean_temp" versus "year" and "month"
fig, axs = plt.subplots(1,2, figsize=(10,6))
sns.lineplot(data=df, x='month', y='mean_temp', ax=axs[0])
axs[0].set_title('Mean Monthly Temperatures')
sns.lineplot(data=df, x='year', y='mean_temp', ax=axs[1])
axs[1].set_title('Mean Yearly Temperatures')
plt.tight_layout()
plt.show()
#view correlation between features
corr_matrix = df.corr()
fig, axes = plt.subplots(2,1, figsize=(10,10))
sns.heatmap(corr_matrix[['mean_temp']], ax=axes[0])
axes[0].set_title('Correlation of Features and Mean Temperature')
sns.heatmap(corr_matrix, ax=axes[1])
axes[1].set_title('Correlation of all Features')
"""### Feature Selection
- Select features that are strongly correlated with mean temperature
"""
rel_features = corr_matrix[corr_matrix['mean_temp'] > 0.5].columns
#select relevant features
selected_df = df[rel_features]
#drop rows with missing values in the target variable
selected_df.dropna(subset=['mean_temp'], inplace=True)
"""## Data Preprocessing
- Splitting data into train and test sets
- Handling missing values
- Data Normalisation
"""
#split data
X = selected_df
y = X.pop('mean_temp')
X_train, X_test, y_train, y_test = train_test_split(X ,y, test_size=0.3, random_state=42)
#pipeline for data preprocessing
preprocess_df = make_pipeline(SimpleImputer(), StandardScaler())
#preprocess training and test set
newX_train = preprocess_df.fit_transform(X_train.drop(columns=['date','year','day']))
newX_test = preprocess_df.transform(X_test.drop(columns=['date','year', 'day']))
"""### Model Tracking and Training
### Model Logging and evaluating with MLflow
"""
mlflow.set_experiment('London Temperature')
for idx, depth in enumerate([1,5,10,20]):
run_name = f"run_{idx}"
with mlflow.start_run():
#Train models
lr = LinearRegression()
lr.fit(newX_train,y_train)
dt = DecisionTreeRegressor(max_depth=depth)
dt.fit(newX_train, y_train)
rf = RandomForestRegressor(max_depth=depth)
rf.fit(newX_train, y_train)
#calculate RMSE
mlflow.log_metric("lr_rmse", mean_squared_error(y_test, lr.predict(newX_test),squared=False))
mlflow.log_metric("dt_rmse", mean_squared_error(y_test, dt.predict(newX_test), squared=False))
mlflow.log_metric("rf_rmse", mean_squared_error(y_test, rf.predict(newX_test), squared=False))
# Log the trained model as an artifact
mlflow.sklearn.log_model(lr, "lr_model", registered_model_name="lrtemp")
mlflow.sklearn.log_model(dt, "dt_model", registered_model_name="dttemp")
mlflow.sklearn.log_model(rf, "rf_model", registered_model_name="rftemp")
"""### Searching logged results"""
experiment_results = mlflow.search_runs()
experiment_results
"""## Model Evaluation
- The Random Regressor gives the best result with RMSE of 0.861
"""
# Sort the DataFrame by the metrics columns in ascending order
df_sorted_dt_rmse = experiment_results.sort_values(by='metrics.dt_rmse')
df_sorted_rf_rmse = experiment_results.sort_values(by='metrics.rf_rmse')
df_sorted_lr_rmse = experiment_results.sort_values(by='metrics.lr_rmse')
# Get the best model for each metric
best_model_dt_rmse = df_sorted_dt_rmse.iloc[0]
best_model_rf_rmse = df_sorted_rf_rmse.iloc[0]
best_model_lr_rmse = df_sorted_lr_rmse.iloc[0]
print("Best model based on Decision regressor model:")
print(best_model_dt_rmse['metrics.dt_rmse'])
print("\nBest model based on Random Forest regressor model:")
print(best_model_rf_rmse['metrics.rf_rmse'])
print("\nBest model based on Linear regression model:")
print(best_model_lr_rmse['metrics.lr_rmse'])
#View the random regressor model
client = mlflow.MlflowClient()
dt_filter_string = "name = 'rftemp'"
# Search for Random Forest Regressor Models
print(client.search_registered_models(filter_string=dt_filter_string))
"""### Load Best Model"""
#best model run id
best_model_run_id = best_model_rf_rmse['run_id']
#best model uri
best_model_arti_uri = best_model_rf_rmse['artifact_uri']
#full uri path
best_model_uri = f'{best_model_arti_uri}/rf_model'
model = mlflow.sklearn.load_model(best_model_uri)
#model = mlflow.pyfunc.load_model(f"runs:/{best_model_run_id}/rf_model")
"""#### Best model version"""
#Get best model version
model_name = "rftemp"
version = client.search_model_versions(f"name='{model_name}'")
[model for model in version if model.run_id == best_model_run_id]
"""#### Parameters of the best model"""
#Get parameters ofm the best model
params = model.get_params()
params
#Dataframe of best Model Parameters
params_df = pd.DataFrame(params.items(), columns=['Parameter', 'Value'])
params_df
"""## Transition Model to Testing and Production Stages
- Random Regressor Model version 3 moved to Production stage
"""
# Transition version 3 of Insurance model to testing stage
client.transition_model_version_stage(name="rftemp", version=3,
stage="Staging"
)
# Transition Model to Production
client.transition_model_version_stage(name="rftemp", version=3, stage="Production")
"""###Load Producton Model"""
# Load the Production stage of the Random regressor model
prod_model = mlflow.sklearn.load_model("models:/rftemp/Production")
"""## Testing Production Model
- Production Model has accuracy of 97.7%
"""
prod_model.score(newX_test, y_test)