{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import pandas as pd \nimport matplotlib.pyplot as plt \nimport numpy as np \nimport seaborn as sns\nfrom tqdm.notebook import tqdm \n\nimport matplotlib\nfrom matplotlib import rc\n\nrc(\"font\", **{\"family\": \"sans-serif\", \"sans-serif\": \"DejaVu Sans\"})\nrc(\"figure\", **{\"dpi\": 200})\nrc(\n    \"axes\",\n    **{\"spines.right\": False, \"spines.top\": False, \"xmargin\": 0.0, \"ymargin\": 0.05}\n)","metadata":{"_uuid":"349a1362-e369-49ae-906d-1b5f8a48475d","_cell_guid":"994dad23-6226-4b87-a0be-56f9a378ac40","collapsed":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-05-09T20:13:02.218706Z","iopub.execute_input":"2022-05-09T20:13:02.219029Z","iopub.status.idle":"2022-05-09T20:13:03.399706Z","shell.execute_reply.started":"2022-05-09T20:13:02.218947Z","shell.execute_reply":"2022-05-09T20:13:03.398888Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df = pd.read_csv('../input/eurecom-aml-2022-challenge-1/public/train.csv', low_memory=True)","metadata":{"execution":{"iopub.status.busy":"2022-05-09T20:13:03.401086Z","iopub.execute_input":"2022-05-09T20:13:03.401425Z","iopub.status.idle":"2022-05-09T20:14:22.288642Z","shell.execute_reply.started":"2022-05-09T20:13:03.401397Z","shell.execute_reply":"2022-05-09T20:14:22.287252Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_test = pd.read_csv('../input/eurecom-aml-2022-challenge-1/public/test_feat.csv', low_memory=True)","metadata":{"execution":{"iopub.status.busy":"2022-05-09T20:14:22.291411Z","iopub.execute_input":"2022-05-09T20:14:22.29193Z","iopub.status.idle":"2022-05-09T20:14:42.373137Z","shell.execute_reply.started":"2022-05-09T20:14:22.291878Z","shell.execute_reply":"2022-05-09T20:14:42.372379Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Data analysis\n\nIn this challenge, you are free (and encouraged) to explore in depth the data you have, you can run simple queries on the data, perform exploration and compute statistics.\n\n**NOTE**: finding the right question to ask is difficult! Don't be afraid to complement your analysis with your own questions. This can give you extra points!\n\n**NOTE 2**: the presentation quality is critical in any business-oriented data analysis. Take time to create few but informative plots, rather than endless tables! ","metadata":{}},{"cell_type":"markdown","source":"We first see what the data looks like, and print some general and statistical information about the dataset.\nWe also compute the number of null values for each column in the dataset.","metadata":{}},{"cell_type":"code","source":"df.head()\ndf.info()\ndf.describe()","metadata":{"execution":{"iopub.status.busy":"2022-05-09T20:14:42.374987Z","iopub.execute_input":"2022-05-09T20:14:42.375204Z","iopub.status.idle":"2022-05-09T20:14:42.426962Z","shell.execute_reply.started":"2022-05-09T20:14:42.375176Z","shell.execute_reply":"2022-05-09T20:14:42.426115Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-05-09T20:44:24.185218Z","iopub.execute_input":"2022-05-09T20:44:24.185736Z","iopub.status.idle":"2022-05-09T20:44:24.611384Z","shell.execute_reply.started":"2022-05-09T20:44:24.185702Z","shell.execute_reply":"2022-05-09T20:44:24.610403Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Here we analyse the location of the data contained by the training and the dataset. We notice that the regions are different between the two datasets.","metadata":{}},{"cell_type":"code","source":"tr_coordinates = df[['fact_latitude','fact_longitude']].drop_duplicates()\nte_coordinates = df_test[['fact_latitude','fact_longitude']].drop_duplicates()","metadata":{"execution":{"iopub.status.busy":"2022-05-09T20:44:28.191708Z","iopub.execute_input":"2022-05-09T20:44:28.191999Z","iopub.status.idle":"2022-05-09T20:44:28.352289Z","shell.execute_reply.started":"2022-05-09T20:44:28.191969Z","shell.execute_reply":"2022-05-09T20:44:28.351477Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"merged = te_coordinates.merge(tr_coordinates, how='left', indicator=True)\ntropic_coordinates = merged[merged['_merge']=='left_only']\ncommon_coordinates = merged[merged['_merge']=='both']","metadata":{"execution":{"iopub.status.busy":"2022-05-09T20:44:30.080659Z","iopub.execute_input":"2022-05-09T20:44:30.081303Z","iopub.status.idle":"2022-05-09T20:44:30.114976Z","shell.execute_reply.started":"2022-05-09T20:44:30.081253Z","shell.execute_reply":"2022-05-09T20:44:30.114021Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig, (ax0, ax1) = plt.subplots(1, 2, figsize=[10, 3], dpi=200, sharex=True, sharey=True)\nax0.scatter(tr_coordinates['fact_longitude'], tr_coordinates['fact_latitude'], \n            s=1, c='tab:green', label='Train data')\nax1.scatter(common_coordinates['fact_longitude'], common_coordinates['fact_latitude'], \n            s=1, c='tab:orange', label='In-domain test data')\nax1.scatter(tropic_coordinates['fact_longitude'], tropic_coordinates['fact_latitude'], \n            s=1, c='tab:red', label='Out-domain test data')\nax0.legend(), ax1.legend()\nfig.suptitle('Distribution of train and test points in the dataset', y=1.01, fontsize=14)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-05-09T20:44:33.015915Z","iopub.execute_input":"2022-05-09T20:44:33.016222Z","iopub.status.idle":"2022-05-09T20:44:33.915134Z","shell.execute_reply.started":"2022-05-09T20:44:33.016188Z","shell.execute_reply":"2022-05-09T20:44:33.911052Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"After looking at the location of the data, we look at the date. We notice that all the data were taken between September 2018 and February 2019. Moreover, the amount of data per month is quite balanced between the training and the testing set. Hence, we understand that our work will be to determine the temperature in unseen regions but in a period of time we can train on.","metadata":{}},{"cell_type":"code","source":"df['date'] = pd.to_datetime(df['fact_time'], unit='s')\ndf['month'] = pd.DatetimeIndex(df['date']).month\ndf_test['date'] = pd.to_datetime(df_test['fact_time'], unit='s')\ndf_test['month'] = pd.DatetimeIndex(df_test['date']).month\n\ndf['date'].describe()\n\ndf_test['date'].describe()\n\nmonth_count_train = df.groupby(df.month).count().sort_values(by=['month'])\nmonth_count_train = month_count_train['index'].plot(kind='bar',xlabel='Month repartition for the training set')\n\nmonth_count_test = df_test.groupby(df_test.month).count().sort_values(by=['month'])\nmonth_count_test = month_count_test['index'].plot(kind='bar',color='red',xlabel='Month repartition for the testing set')","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"\n# Data Pre-processing\n\nThe previous step should give you a better understanding of which pre-processing is required for the data. This may include:\n\n-    Normalising and standardising the given data;\n-    Removing outliers;\n-    Carrying out feature selection, possibly using metrics derived from information theory;\n-    Handling missing information in the dataset;\n-    Augmenting the dataset with external information;\n-    Combining existing features.","metadata":{}},{"cell_type":"markdown","source":"We plot the correlation matrix to see the most correlated features with the target **'fact_temperature'**.","metadata":{}},{"cell_type":"markdown","source":"We have 112 features describing the data samples. Probably not all of these feature are importatnt to predict our target which is fact_temperature).\nThus we only want to keep columns which are relevent to this problem, by looking at the correlation between different features. For that we plot the correlation matrix between the features and fact_temperature","metadata":{}},{"cell_type":"code","source":"df_train_target = df['fact_temperature']\ndf_train = df.drop(['fact_temperature'], axis=1)\n\n#correlation matrix\ncorrmat = np.abs(pd.concat([df_train, df_train_target], axis=1).corr())\nmask = np.zeros_like(corrmat)\nmask[np.triu_indices_from(mask)] = True\nwith sns.axes_style(\"white\"):\n    f, ax = plt.subplots(figsize=(32, 32))\n    ax = sns.heatmap(corrmat, mask=mask, square=True, cmap=\"YlGnBu\")","metadata":{"execution":{"iopub.status.busy":"2022-05-09T21:09:22.444471Z","iopub.execute_input":"2022-05-09T21:09:22.445885Z","iopub.status.idle":"2022-05-09T21:10:48.920863Z","shell.execute_reply.started":"2022-05-09T21:09:22.44582Z","shell.execute_reply":"2022-05-09T21:10:48.919865Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"We notice the navy blue squares, which shows that there is an obvious correlation between these features and fact_temperature. Now we can look at the 25 most features directly correlated with our target.","metadata":{}},{"cell_type":"code","source":"col_selection = ['climate_temperature',\n                   'cmc_0_0_6_2',\n                   'cmc_0_1_0_0', \n                   'cmc_0_3_5_500', \n                   'gfs_2m_dewpoint', \n                   'gfs_precipitable_water', \n                   'gfs_temperature_25000',\n                   'gfs_temperature_30000',\n                   'gfs_temperature_40000',\n                   'gfs_temperature_45000',\n                   'gfs_temperature_50000', \n                   'gfs_temperature_55000',\n                   'gfs_temperature_60000',\n                   'gfs_temperature_65000',\n                   'gfs_temperature_70000',\n                   'gfs_temperature_75000',\n                   'gfs_temperature_80000',\n                   'gfs_temperature_85000',\n                   'gfs_temperature_90000',\n                   'gfs_temperature_92500',\n                   'gfs_temperature_95000',\n                   'gfs_temperature_97500',\n                   'wrf_t2_next',\n                   'wrf_t2_interpolated',\n                   'gfs_2m_dewpoint_next',\n                    'fact_temperature']","metadata":{"execution":{"iopub.status.busy":"2022-05-09T22:20:09.499107Z","iopub.execute_input":"2022-05-09T22:20:09.499724Z","iopub.status.idle":"2022-05-09T22:20:09.507209Z","shell.execute_reply.started":"2022-05-09T22:20:09.499675Z","shell.execute_reply":"2022-05-09T22:20:09.506332Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X = df[col_selection].dropna().iloc[:, 1:-1].values\ny = df[col_selection].dropna().iloc[:, -1].values","metadata":{"execution":{"iopub.status.busy":"2022-05-09T22:20:11.952453Z","iopub.execute_input":"2022-05-09T22:20:11.952769Z","iopub.status.idle":"2022-05-09T22:20:12.149441Z","shell.execute_reply.started":"2022-05-09T22:20:11.952737Z","shell.execute_reply":"2022-05-09T22:20:12.148651Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"We compute the percentage of missing data for each feature.","metadata":{}},{"cell_type":"code","source":"#Missing data\n\ntotal = df.isnull().sum().sort_values(ascending=False)\npercent = (df.isnull().sum()/df.isnull().count()).sort_values(ascending=False)\nmissing_data = pd.concat([total, percent], axis=1, keys=['Total', 'Percent'])\nmissing_data.head(10)","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"The feature with the highest number of missing values has only 5% of them. There is no need to drop features on this criteria.\n\nFinally, we check if the ourget 'fact_temperature' is skewed, and if it is, we normalize it.","metadata":{}},{"cell_type":"code","source":"#Check if our target is skewed or not\nfrom scipy import stats\nimport seaborn as sns\n\nprint(\"Skewness: %f\" % df[['fact_temperature']].skew())\nsns.distplot(df['fact_temperature'], fit=stats.norm)","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"The skewness score is close to 0, so no need to normalize and center the target.","metadata":{}},{"cell_type":"markdown","source":"\n# Model Selection\n\nPerhaps one of the most important segments of this challenge involves the selection of a model that can successfully handle the given data and yield sensible predictions. Instead of focusing exclusively on your final chosen model, it is also important to share your thought process in this notebook by additionally describing alternative candidate models. There is a wealth of models to choose from, such as decision trees, random forests, (Bayesian) neural networks, Gaussian processes, Lasso regression, and so on. There are several factors which may influence your decision:\n\n-    What is the model's complexity?\n-    Is the model interpretable?\n-    Is the model capable of handling different data-types?\n-    Does the model return uncertainty estimates along with predictions?\n\nIn this baseline solution, we use the Lasso regression model, which is a linear least-square model with L1 regularization on its parameters. There is a hyper-parameter that should be tuned which is the regularization strength α. Intuitively, this hyper-parameter controls the amount of shrinkage of the parameters of the model: the larger the value of α the greater the amount of shrinkage.\n\nSection 3.4.1 of the book The Elements of Statistical Learning: Data Mining, Inference, and Prediction from Trevor Hastie et al. (https://hastie.su.domains/Papers/ESLII.pdf) is a good reference for some classic regression models.","metadata":{}},{"cell_type":"code","source":"from sklearn.model_selection import train_test_split\nXtr, Xval, ytr, yval = train_test_split(X, y, random_state=1, test_size=10000)","metadata":{"execution":{"iopub.status.busy":"2022-05-09T22:20:17.711013Z","iopub.execute_input":"2022-05-09T22:20:17.711298Z","iopub.status.idle":"2022-05-09T22:20:17.982616Z","shell.execute_reply.started":"2022-05-09T22:20:17.711268Z","shell.execute_reply":"2022-05-09T22:20:17.98156Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"We use StandardScaler to standarize the data (we also tried MaxMin and RobustScaler but ScanderScaler permors the best).","metadata":{}},{"cell_type":"code","source":"from sklearn.preprocessing import StandardScaler\n\nscaler = StandardScaler()  \nXtr = scaler.fit_transform(Xtr)  \nXval = scaler.transform(Xval) ","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"In this part, we try several Regression models, and test them on our validation set.","metadata":{}},{"cell_type":"code","source":"from sklearn.linear_model import Lasso\n\ndef compute_rmse(y, ypred, ystd=1.):\n    return np.mean((y - ypred)**2)**0.5 * ystd\n\nmodel = Lasso(alpha=0.001)\nmodel.fit(Xtr, ytr)\nypred_tr = model.predict(Xtr)\nypred_val = model.predict(Xval)\n\nprint(f'Train RMSE: {compute_rmse(ytr, ypred_tr, ystd):.3f}')\nprint(f'Valid RMSE: {compute_rmse(yval, ypred_val, ystd):.3f}')","metadata":{"execution":{"iopub.status.busy":"2022-05-09T22:20:19.530335Z","iopub.execute_input":"2022-05-09T22:20:19.530669Z","iopub.status.idle":"2022-05-09T22:20:19.662993Z","shell.execute_reply.started":"2022-05-09T22:20:19.530622Z","shell.execute_reply":"2022-05-09T22:20:19.661463Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.neural_network import MLPRegressor\n\nmodel2 = MLPRegressor(random_state=1, \n                      max_iter=500, \n                      solver='sgd', \n                      learning_rate='adaptive', \n                      activation='logistic')\nmodel2.fit(Xtr, ytr)\n\nypred_tr = model2.predict(Xtr)\nypred_val = model2.predict(Xval)\n\nprint(f'Train RMSE: {compute_rmse(ytr, ypred_tr):.3f}')\nprint(f'Valid RMSE: {compute_rmse(yval, ypred_val):.3f}')","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.linear_model import BayesianRidge, LinearRegression\n\nmodel3 = BayesianRidge()\nmodel3.fit(Xtr, ytr)\n\nypred_tr = model3.predict(Xtr)\nypred_val = model3.predict(Xval)\n\nprint(f'Train RMSE: {compute_rmse(ytr, ypred_tr, ystd):.3f}')\nprint(f'Valid RMSE: {compute_rmse(yval, ypred_val, ystd):.3f}')","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.tree import DecisionTreeRegressor\n\nmodel4 = DecisionTreeRegressor()\nmodel4.fit(Xtr, ytr)\n\nypred_tr = model4.predict(Xtr)\nypred_val = model4.predict(Xval)\n\nprint(f'Train RMSE: {compute_rmse(ytr, ypred_tr, ystd):.3f}')\nprint(f'Valid RMSE: {compute_rmse(yval, ypred_val, ystd):.3f}')","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.ensemble import RandomForestRegressor\n\ndef compute_rmse(y, ypred, ystd=1.):\n    return np.mean((y - ypred)**2)**0.5 * ystd\n\nmodel5 = RandomForestRegressor(n_estimators=5)\nmodel5.fit(Xtr, ytr)\n\nypred_tr = model5.predict(Xtr)\nypred_val = model5.predict(Xval)\n\nprint(f'Train RMSE: {compute_rmse(ytr, ypred_tr):.3f}')\nprint(f'Valid RMSE: {compute_rmse(yval, ypred_val):.3f}')","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.linear_model import SGDRegressor\n\nmodel6 = SGDRegressor()\nmodel6.fit(Xtr, ytr)\n\nypred_tr = model6.predict(Xtr)\nypred_val = model6.predict(Xval)\n\nprint(f'Train RMSE: {compute_rmse(ytr, ypred_tr, ystd):.3f}')\nprint(f'Valid RMSE: {compute_rmse(yval, ypred_val, ystd):.3f}')","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Parameter Optimisation\n\nIrrespective of your choice, it is highly likely that your model will have one or more parameters that require tuning. There are several techniques for carrying out such a procedure, including cross-validation, Bayesian optimisation, and several others. As before, an analysis into which parameter tuning technique best suits your model is expected before proceeding with the optimisation of your model.\n\nThe below cells demonstrate tuning the hyper-parameters α of the Ridge regression model by using cross-validation.","metadata":{}},{"cell_type":"code","source":"from sklearn.model_selection import RandomizedSearchCV, GridSearchCV","metadata":{"execution":{"iopub.status.busy":"2022-05-09T22:20:42.018896Z","iopub.execute_input":"2022-05-09T22:20:42.01934Z","iopub.status.idle":"2022-05-09T22:20:42.024744Z","shell.execute_reply.started":"2022-05-09T22:20:42.019287Z","shell.execute_reply":"2022-05-09T22:20:42.023642Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import numpy as np\n\ndef get_cv_idx(n, test_size=0.2, n_splits=2):\n    train_idx, test_idx = [], []\n    for _ in range(n_splits):\n        idx = np.random.permutation(n)\n        train_size = int(n * (1 - test_size)) if isinstance(test_size, float) else n - test_size\n        train_idx.append(idx[:train_size])\n        test_idx.append(idx[train_size:])\n    return train_idx, test_idx","metadata":{"execution":{"iopub.status.busy":"2022-05-09T22:20:44.280885Z","iopub.execute_input":"2022-05-09T22:20:44.281603Z","iopub.status.idle":"2022-05-09T22:20:44.287711Z","shell.execute_reply.started":"2022-05-09T22:20:44.281552Z","shell.execute_reply":"2022-05-09T22:20:44.28666Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_idx, cv_idx = get_cv_idx(len(Xtr), test_size=10000, n_splits=10)","metadata":{"execution":{"iopub.status.busy":"2022-05-09T22:20:47.318876Z","iopub.execute_input":"2022-05-09T22:20:47.319186Z","iopub.status.idle":"2022-05-09T22:20:48.010662Z","shell.execute_reply.started":"2022-05-09T22:20:47.319151Z","shell.execute_reply":"2022-05-09T22:20:48.009793Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"param_grid = {\n    \"alpha\": [0.001, 0.01, 0.1, 1, 10]\n}\n\nsearch = GridSearchCV(model, \n                      param_grid,\n                      n_jobs=-1, \n                      verbose=1,\n                      cv=zip(train_idx, cv_idx), \n                      scoring='neg_root_mean_squared_error').fit(Xtr, ytr)\nprint('Done!')","metadata":{"execution":{"iopub.status.busy":"2022-05-09T22:20:49.52908Z","iopub.execute_input":"2022-05-09T22:20:49.529401Z","iopub.status.idle":"2022-05-09T22:20:59.934634Z","shell.execute_reply.started":"2022-05-09T22:20:49.529358Z","shell.execute_reply":"2022-05-09T22:20:59.933531Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"params = { \n    'solver' :['lbfgs', 'sgd', 'adam'],\n    'activation': ['identity', 'logistic', 'tanh', 'relu'],\n    'alpha': [0.001,0.01,0.1,1],\n    'batch_size': [50,100,200,400],\n    'learning_rate': ['constant', 'invscaling', 'adaptive']\n}\nsearch = RandomizedSearchCV(estimator=model2,\n                         param_distributions=params,\n                         scoring='neg_mean_squared_error',\n                         n_iter=5,\n                         verbose=10)\nsearch.fit(Xtr, ytr)\n\nprint('Done!')","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"Best parameters set found on cv set:\")\nprint(search.best_params_)\nprint()\nprint(\"Grid scores on cv set:\")\nmeans = search.cv_results_[\"mean_test_score\"]\nstds = search.cv_results_[\"std_test_score\"]\nfor mean, std, params in zip(means, stds, search.cv_results_[\"params\"]):\n    print(\"%0.3f (+/-%0.03f) for %r\" % (-mean * ystd, (std * ystd) * 2, params))\nprint()\nprint(\"Error on the validation set\")\nypred_val = search.predict(Xval)\nprint(f'Valid RMSE: {compute_rmse(yval, ypred_val, ystd):.3f}')","metadata":{"execution":{"iopub.status.busy":"2022-05-09T22:21:03.527321Z","iopub.execute_input":"2022-05-09T22:21:03.527829Z","iopub.status.idle":"2022-05-09T22:21:03.541634Z","shell.execute_reply.started":"2022-05-09T22:21:03.527784Z","shell.execute_reply":"2022-05-09T22:21:03.540255Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Model Evaluation\n\nSome form of pre-evaluation will inevitably be required in the preceding sections in order to both select an appropriate model and configure its parameters appropriately. In this final section, you may evaluate other aspects of the model such as:\n\n-    Assessing the running time of your model;\n-    Determining whether some aspects can be parallelised;\n-    Training the model with smaller subsets of the data.\n-    etc.\n\nRemember, the goal of this challenge is to construct a model for predicting the temperature around the globe.\n\n","metadata":{}},{"cell_type":"code","source":"df_test = pd.read_csv('../input/eurecom-aml-2022-challenge-1/public/test_feat.csv', low_memory=True)","metadata":{"execution":{"iopub.status.busy":"2022-05-09T22:21:09.21555Z","iopub.execute_input":"2022-05-09T22:21:09.215875Z","iopub.status.idle":"2022-05-09T22:21:22.733147Z","shell.execute_reply.started":"2022-05-09T22:21:09.215842Z","shell.execute_reply":"2022-05-09T22:21:22.732122Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"col_selection = [\n    'climate_temperature',\n                   'cmc_0_0_6_2',\n                   'cmc_0_1_0_0', \n                   'cmc_0_3_5_500', \n                   'gfs_2m_dewpoint', \n                   'gfs_precipitable_water', \n                   'gfs_temperature_25000',\n                   'gfs_temperature_30000',\n                   'gfs_temperature_40000',\n                   'gfs_temperature_45000',\n                   'gfs_temperature_50000', \n                   'gfs_temperature_55000',\n                   'gfs_temperature_60000',\n                   'gfs_temperature_65000',\n                   'gfs_temperature_70000',\n                   'gfs_temperature_75000',\n                   'gfs_temperature_80000',\n                   'gfs_temperature_85000',\n                   'gfs_temperature_90000',\n                   'gfs_temperature_92500',\n                   'gfs_temperature_95000',\n                   'gfs_temperature_97500',\n                   'wrf_t2_next',\n                   'wrf_t2_interpolated',\n                   'gfs_2m_dewpoint_next'\n]\n\nXte = df_test[col_selection].iloc[:, :].values\n\nXte = scaler.transform(Xte)","metadata":{"execution":{"iopub.status.busy":"2022-05-09T22:21:24.197822Z","iopub.execute_input":"2022-05-09T22:21:24.198124Z","iopub.status.idle":"2022-05-09T22:21:24.210336Z","shell.execute_reply.started":"2022-05-09T22:21:24.198093Z","shell.execute_reply":"2022-05-09T22:21:24.209523Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ypred_te = search.predict(Xte)  # Remember to un-standardize the predictions","metadata":{"execution":{"iopub.status.busy":"2022-05-09T22:21:26.540853Z","iopub.execute_input":"2022-05-09T22:21:26.541669Z","iopub.status.idle":"2022-05-09T22:21:26.552416Z","shell.execute_reply.started":"2022-05-09T22:21:26.541612Z","shell.execute_reply":"2022-05-09T22:21:26.551316Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"\n# Submission\nYour submission is a CSV file containing your final model's predictions on the given test data. This file should contain a header and have the following format:\n\n```\nindex,fact_temperature\n1993574,3.9865149124872303\n1993575,18.165092058370533\n1993576,16.53315442160854\n1993577,8.377598784006866\n...\n```\n\nA leaderboard for this challenge will be ranked using the root mean squared error between the predicted values and the observed arrival delays. However, you can use other metrics for regression tasks in your presentation notebook to evaluate many aspects of your model, including quantification of the uncertainty in the predictions.\n\nBelow is an example of creating a submission file.\n","metadata":{}},{"cell_type":"code","source":"submission_df = pd.DataFrame(data={'index': df_test['index'].values,\n                                   'fact_temperature': ypred_te.squeeze()})\n\n# Save the predictions into a csv file\n# Notice that this file should be saved under the directory `/kaggle/working` \n# so that you can download it later\nsubmission_df.to_csv(\"/kaggle/working/submission.csv\", index=False)","metadata":{"execution":{"iopub.status.busy":"2022-05-09T22:21:29.889748Z","iopub.execute_input":"2022-05-09T22:21:29.890099Z","iopub.status.idle":"2022-05-09T22:21:31.794882Z","shell.execute_reply.started":"2022-05-09T22:21:29.890061Z","shell.execute_reply":"2022-05-09T22:21:31.79394Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Check the submission file\n! head -6 \"/kaggle/working/submission.csv\"","metadata":{"execution":{"iopub.status.busy":"2022-05-09T22:21:40.369724Z","iopub.execute_input":"2022-05-09T22:21:40.370025Z","iopub.status.idle":"2022-05-09T22:21:41.163658Z","shell.execute_reply.started":"2022-05-09T22:21:40.369994Z","shell.execute_reply":"2022-05-09T22:21:41.16275Z"},"trusted":true},"execution_count":null,"outputs":[]}]}