{"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":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        os.path.join(dirname, filename)\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2021-06-19T14:28:22.071846Z","iopub.execute_input":"2021-06-19T14:28:22.072344Z","iopub.status.idle":"2021-06-19T14:28:22.230795Z","shell.execute_reply.started":"2021-06-19T14:28:22.072303Z","shell.execute_reply":"2021-06-19T14:28:22.2301Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import numpy as np\nimport pandas as pd\nfrom pathlib import Path\nfrom tqdm import tqdm\nimport matplotlib.pyplot as plt\n\n#from sklearn.linear_model import LinearRegression\nfrom sklearn.model_selection import train_test_split\n\ntrainfile = pd.read_csv(\"../input/google-smartphone-decimeter-challenge/baseline_locations_train.csv\")\ntestfile = pd.read_csv(\"../input/google-smartphone-decimeter-challenge/baseline_locations_test.csv\")\ndatapath = Path(\"../input/google-smartphone-decimeter-challenge\")\ntruths = (datapath/'train').rglob('ground_truth.csv')\ncols1 = ['collectionName', 'phoneName', 'millisSinceGpsEpoch', 'latDeg',\n       'lngDeg']\ntruthlist = []\nfor fpath in truths:\n    fcsv = pd.read_csv(fpath, usecols = cols1)\n    truthlist.append(fcsv)\n\ntruthdata = pd.concat(truthlist, ignore_index = True) # dump all truth files into a single file","metadata":{"execution":{"iopub.status.busy":"2021-06-19T14:28:40.861045Z","iopub.execute_input":"2021-06-19T14:28:40.86139Z","iopub.status.idle":"2021-06-19T14:28:41.573226Z","shell.execute_reply.started":"2021-06-19T14:28:40.861359Z","shell.execute_reply":"2021-06-19T14:28:41.572273Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\ncols2 = ['collectionName','phoneName','millisSinceGpsEpoch','constellationType','svid','signalType','receivedSvTimeInGpsNanos','xSatPosM','ySatPosM','zSatPosM']\nlogs = (datapath/'train').rglob('*derived.csv')\n\nlogslist = []\nfor fpath in logs:\n    logcsv = pd.read_csv(fpath, usecols = cols2)\n    logslist.append(logcsv)\n\nlogsdata = pd.concat(logslist, ignore_index = True) # dump all derived logs files into a single file\nlogsdata['constellationType'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2021-06-19T14:29:11.193433Z","iopub.execute_input":"2021-06-19T14:29:11.193774Z","iopub.status.idle":"2021-06-19T14:29:27.006488Z","shell.execute_reply.started":"2021-06-19T14:29:11.19374Z","shell.execute_reply":"2021-06-19T14:29:27.005317Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"logsdata['svid'].value_counts().index[0]","metadata":{"execution":{"iopub.status.busy":"2021-06-15T14:30:56.945498Z","iopub.execute_input":"2021-06-15T14:30:56.945874Z","iopub.status.idle":"2021-06-15T14:30:56.985017Z","shell.execute_reply.started":"2021-06-15T14:30:56.945844Z","shell.execute_reply":"2021-06-15T14:30:56.984022Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"logsdata_svtime = logsdata.groupby(['collectionName','phoneName','millisSinceGpsEpoch']).receivedSvTimeInGpsNanos.apply(lambda x: np.min(x)).reset_index()\nlogsdata_xsat = logsdata.groupby(['collectionName','phoneName','millisSinceGpsEpoch']).xSatPosM.apply(lambda x: np.average(x)).reset_index()\nlogsdata_ysat = logsdata.groupby(['collectionName','phoneName','millisSinceGpsEpoch']).ySatPosM.apply(lambda x: np.average(x)).reset_index()\nlogsdata_zsat = logsdata.groupby(['collectionName','phoneName','millisSinceGpsEpoch']).zSatPosM.apply(lambda x: np.average(x)).reset_index()\nlogsdata_svid = logsdata.groupby(['collectionName','phoneName','millisSinceGpsEpoch']).svid.apply(lambda x: x.value_counts().index[0]).reset_index()\n#logsdata_constellation = logsdata.groupby(['collectionName','phoneName','millisSinceGpsEpoch']).constellationType.apply(lambda x:x.value_counts().index[0]).reset_index()\nlogsdata_signaltype = logsdata.groupby(['collectionName','phoneName','millisSinceGpsEpoch']).signalType.apply(lambda x: x.value_counts().index[0]).reset_index()\n\nlogsdata1 = logsdata_svtime.merge(logsdata_xsat, on = ['collectionName','phoneName','millisSinceGpsEpoch'])\nlogsdata2 = logsdata1.merge(logsdata_ysat, on = ['collectionName','phoneName','millisSinceGpsEpoch'])\nlogsdata3 = logsdata2.merge(logsdata_zsat, on = ['collectionName','phoneName','millisSinceGpsEpoch'])\nlogsdata4 = logsdata3.merge(logsdata_svid, on = ['collectionName','phoneName','millisSinceGpsEpoch'])\n#logsdata5 = logsdata4.merge(logsdata_constellation, on = ['collectionName','phoneName','millisSinceGpsEpoch'])\nlogsdata_final = logsdata4.merge(logsdata_signaltype, on = ['collectionName','phoneName','millisSinceGpsEpoch'])\n#logsdata_final['constellationType'] = logsdata_final.constellationType.apply(lambda x: \"one\" if x == 1 else(\"two\" if x == 2 else(\"three\" if x == 3 else(\"four\" if x == 4 else(\"five\" if x == 5 else(\"six\" if x == 6 else \"zero\"))))))                                                                                                 \nlogsdata_final.head()","metadata":{"execution":{"iopub.status.busy":"2021-06-19T14:29:35.181638Z","iopub.execute_input":"2021-06-19T14:29:35.181961Z","iopub.status.idle":"2021-06-19T14:31:46.588755Z","shell.execute_reply.started":"2021-06-19T14:29:35.181931Z","shell.execute_reply":"2021-06-19T14:31:46.587897Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(len(logsdata_final))\nprint(len(trainfile))\ntraindata1 = trainfile.merge(truthdata, on = cols1[:3], suffixes=(\"_current\",\"_truth\")) # merge train file with observed data\ntraindata = pd.merge(traindata1, logsdata_final, how = 'left', on = ['collectionName','phoneName','millisSinceGpsEpoch'])\ntraindata.sort_values(by = ['phone','millisSinceGpsEpoch'])\n#traindata = trainfile.merge(truthdata, on = cols1[:3], suffixes=(\"_current\",\"_truth\")) # merge train file with observed data\n#traindata = traindata.merge(logsdata, on = cols1[:3]) # add columns from gnss logs to the traindata\ntraindata.head()\ntraindata = traindata.fillna(0)\ntraindata['latDeg_prev'] = traindata['latDeg_current'].shift(1).where(traindata['phone'].eq(traindata['phone'].shift(1)))\ntraindata['lngDeg_prev'] = traindata['lngDeg_current'].shift(1).where(traindata['phone'].eq(traindata['phone'].shift(1)))    \ntraindata['latDeg_next'] = traindata['latDeg_current'].shift(-1).where(traindata['phone'].eq(traindata['phone'].shift(-1)))\ntraindata['lngDeg_next'] = traindata['lngDeg_current'].shift(-1).where(traindata['phone'].eq(traindata['phone'].shift(-1)))\ntraindata['time_prev'] = traindata['millisSinceGpsEpoch'].shift(1).where(traindata['phone'].eq(traindata['phone'].shift(1)))\ntraindata['time_next'] = traindata['millisSinceGpsEpoch'].shift(-1).where(traindata['phone'].eq(traindata['phone'].shift(-1)))\n\n#traindata['svid'] = pd.Categorical(traindata.svid)\n#traindata['constellationType'] = pd.Categorical(traindata.constellationType) \nfor i in traindata.index:\n    if pd.isna(traindata['latDeg_prev'][i]):\n        traindata['latDeg_prev'][i] = traindata['latDeg_current'][i]\n        traindata['lngDeg_prev'][i] = traindata['lngDeg_current'][i]\n        traindata['time_prev'][i] = traindata['millisSinceGpsEpoch'][i]\n    if pd.isna(traindata['latDeg_next'][i]):\n        traindata['latDeg_next'][i] = traindata['latDeg_current'][i]\n        traindata['lngDeg_next'][i] = traindata['lngDeg_current'][i]\n        traindata['time_next'][i] = traindata['millisSinceGpsEpoch'][i]\n    \n    #if traindata['time_prev'][i] == traindata['millisSinceGpsEpoch'][i]:\n        #traindata['vel_lat'] = 0\n        #traindata['vel_lng'] = 0\n    #else:\n        #traindata['vel_lat'] = (traindata['latDeg_current'][i] - traindata['latDeg_prev'][i])/(traindata['millisSinceGpsEpoch'][i] - traindata['time_prev'][i])\n        #traindata['vel_lng'] = (traindata['lngDeg_current'][i] - traindata['lngDeg_prev'][i])/(traindata['millisSinceGpsEpoch'][i] - traindata['time_prev'][i])\n\ntraindata['time_since_last_read'] = traindata['millisSinceGpsEpoch'] - traindata['time_prev']\ntraindata['latd_prev_est'] = (traindata['latDeg_current'] - traindata['latDeg_prev'])*(10**6)\ntraindata['latd_next_est'] = (traindata['latDeg_next'] - traindata['latDeg_current'])*(10**6)\ntraindata['latd_prev_act'] = (traindata['latDeg_truth'] - traindata['latDeg_prev'])*(10**6)\ntraindata['lngd_prev_est'] = (traindata['lngDeg_current'] - traindata['lngDeg_prev'])*(10**6)\ntraindata['lngd_next_est'] = (traindata['lngDeg_next'] - traindata['lngDeg_current'])*(10**6)\ntraindata['lngd_prev_act'] = (traindata['lngDeg_truth'] - traindata['lngDeg_prev'])*(10**6)\nprint(len(traindata))\n#print(len(trainfile))\ntraindata.head(1)","metadata":{"execution":{"iopub.status.busy":"2021-06-19T14:39:17.653769Z","iopub.execute_input":"2021-06-19T14:39:17.654522Z","iopub.status.idle":"2021-06-19T14:39:19.875468Z","shell.execute_reply.started":"2021-06-19T14:39:17.654472Z","shell.execute_reply":"2021-06-19T14:39:19.874565Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"traindata['lat_d'] = traindata['latDeg_current'] - traindata['latDeg_truth']\ntraindata['lng_d'] = traindata['lngDeg_current'] - traindata['lngDeg_truth']","metadata":{"execution":{"iopub.status.busy":"2021-06-19T14:43:04.818495Z","iopub.execute_input":"2021-06-19T14:43:04.81887Z","iopub.status.idle":"2021-06-19T14:43:04.827399Z","shell.execute_reply.started":"2021-06-19T14:43:04.818836Z","shell.execute_reply":"2021-06-19T14:43:04.826468Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#traindata['time_since_last_read'].value_counts()\ncorr_df = pd.DataFrame(traindata.iloc[:, 3:].corr())# draw correlation between all columns from collection name, phone name, lat & lng Deg both estimated & observed\ncorr_df.to_csv('./corr_df.csv')\n#testfile.head()","metadata":{"execution":{"iopub.status.busy":"2021-06-19T14:46:26.824357Z","iopub.execute_input":"2021-06-19T14:46:26.824785Z","iopub.status.idle":"2021-06-19T14:46:27.0856Z","shell.execute_reply.started":"2021-06-19T14:46:26.82475Z","shell.execute_reply":"2021-06-19T14:46:27.084619Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"x_cols = ['heightAboveWgs84EllipsoidM','time_since_last_read','xSatPosM','ySatPosM','zSatPosM','receivedSvTimeInGpsNanos','latd_prev_est','latd_next_est','lngd_prev_est','lngd_next_est']\nxdata = traindata[x_cols] #creating the x variable df\nxdata.head() # dummies for the categorical variable\n#xdata_dummies = pd.get_dummies(xdata, prefix = \"dum_\")\n#xdata_dummies.columns","metadata":{"execution":{"iopub.status.busy":"2021-06-19T14:56:06.955702Z","iopub.execute_input":"2021-06-19T14:56:06.956174Z","iopub.status.idle":"2021-06-19T14:56:06.976373Z","shell.execute_reply.started":"2021-06-19T14:56:06.956143Z","shell.execute_reply":"2021-06-19T14:56:06.975745Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ydata = traindata[['latd_prev_act','lngd_prev_act']]\nydata.head()","metadata":{"execution":{"iopub.status.busy":"2021-06-19T14:56:22.791539Z","iopub.execute_input":"2021-06-19T14:56:22.792046Z","iopub.status.idle":"2021-06-19T14:56:22.801552Z","shell.execute_reply.started":"2021-06-19T14:56:22.79201Z","shell.execute_reply":"2021-06-19T14:56:22.800776Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.model_selection import train_test_split\nxtrain, xtest, ytrain, ytest = train_test_split(xdata,ydata, test_size = 0.3, random_state = 162)\ncols = list(xtrain.columns)\n#latcols = [e for e in cols if e not in ('latd_prev_act','lngd_prev_act','millisSinceGpsEpoch')]\n#lngcols = [e for e in cols if e not in ('latd_prev_act','lngd_prev_act','millisSinceGpsEpoch')]\n#xtrain.head() -- x train & xtest is already transformed to have the right set of columns\nytrain_lat = ytrain[['latd_prev_act']]\nytest_lat = ytest[['latd_prev_act']]\nytrain_lng = ytrain[['lngd_prev_act']]\nytest_lng = ytest[['lngd_prev_act']]\nxtrain.head()","metadata":{"execution":{"iopub.status.busy":"2021-06-19T14:58:57.064916Z","iopub.execute_input":"2021-06-19T14:58:57.065266Z","iopub.status.idle":"2021-06-19T14:58:57.109288Z","shell.execute_reply.started":"2021-06-19T14:58:57.065236Z","shell.execute_reply":"2021-06-19T14:58:57.108186Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ytrain_lng.head() #check if datasets share the same indexes - for merging dataframes later","metadata":{"execution":{"iopub.status.busy":"2021-06-19T14:59:35.535886Z","iopub.execute_input":"2021-06-19T14:59:35.53623Z","iopub.status.idle":"2021-06-19T14:59:35.543664Z","shell.execute_reply.started":"2021-06-19T14:59:35.536199Z","shell.execute_reply":"2021-06-19T14:59:35.543026Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.ensemble import GradientBoostingRegressor\nfrom sklearn import metrics\nfrom sklearn.model_selection import GridSearchCV # library for random search hyper param tuning\nfrom sklearn import metrics #library for metrics to measure model performance\nparam_grid = {#'bootstrap': [True],  ##applicable only for random forests not gradient boosting \n              'max_depth': [10,15],\n              'n_estimators': [200,300]}   # create random grid\nrf = GradientBoostingRegressor()\n#rf_lat = RandomForestRegressor(bootstrap = True, n_estimators = 100, max_depth = 20, max_features = 'auto')\n#rf_lat.fit(xtrain_lat, ytrain_lat)\n#rf_lat.feature_importances_\nrf_grid_lat = GridSearchCV(estimator = rf, param_grid = param_grid, cv = 5, verbose = 150)\nrf_grid_lat.fit(xtrain, ytrain_lat)\n#xtrain_lat_arr = xtrain_lat.to_numpy()\n#ytrain_lat_arr = ytrain_lat.to_numpy()\n#ytrain_lat_arr\n#rf_grid_lat = rf_grid.fit(xtrain_lat, ytrain_lat)\n#rf_grid_lat.cv_results_\nrf_grid_lat.best_params_ #throws the best model for latitude prediction","metadata":{"execution":{"iopub.status.busy":"2021-06-19T15:00:59.294846Z","iopub.execute_input":"2021-06-19T15:00:59.295362Z","iopub.status.idle":"2021-06-19T16:03:50.720105Z","shell.execute_reply.started":"2021-06-19T15:00:59.295327Z","shell.execute_reply":"2021-06-19T16:03:50.718095Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"rf_grid_lat.feature_importances_","metadata":{"execution":{"iopub.status.busy":"2021-06-19T16:06:26.30486Z","iopub.execute_input":"2021-06-19T16:06:26.305315Z","iopub.status.idle":"2021-06-19T16:06:26.391915Z","shell.execute_reply.started":"2021-06-19T16:06:26.30521Z","shell.execute_reply":"2021-06-19T16:06:26.390659Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"rf_grid_lat.cv_results_","metadata":{"execution":{"iopub.status.busy":"2021-06-19T16:06:32.853986Z","iopub.execute_input":"2021-06-19T16:06:32.854306Z","iopub.status.idle":"2021-06-19T16:06:32.863804Z","shell.execute_reply.started":"2021-06-19T16:06:32.854279Z","shell.execute_reply":"2021-06-19T16:06:32.862813Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.ensemble import GradientBoostingRegressor\nrf = GradientBoostingRegressor()\nrf_lat = GradientBoostingRegressor(n_estimators = 200, max_depth = 10) # fitting with the best regressor & low variance\nrf_lat.fit(xtrain, ytrain_lat)\nypred_lat = rf_lat.predict(xtest)\nrf_lat.feature_importances_\n#score(xtrain_lat, ytrain_lat)","metadata":{"execution":{"iopub.status.busy":"2021-06-19T16:24:10.310376Z","iopub.execute_input":"2021-06-19T16:24:10.310734Z","iopub.status.idle":"2021-06-19T16:26:37.526256Z","shell.execute_reply.started":"2021-06-19T16:24:10.310702Z","shell.execute_reply":"2021-06-19T16:26:37.525279Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"xtrain.columns","metadata":{"execution":{"iopub.status.busy":"2021-06-19T16:26:52.822546Z","iopub.execute_input":"2021-06-19T16:26:52.822907Z","iopub.status.idle":"2021-06-19T16:26:52.830856Z","shell.execute_reply.started":"2021-06-19T16:26:52.82287Z","shell.execute_reply":"2021-06-19T16:26:52.829558Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.model_selection import RandomizedSearchCV\nparam_grid = {#'bootstrap': [True],  ##applicable only for random forests not gradient boosting \n              'max_depth': [15,20,25,30,35,40],\n              'n_estimators': [300,400,500,600]} \nrf_grid_lng = RandomizedSearchCV(estimator = rf, param_distributions = param_grid, cv = 5, n_iter = 8, verbose = 250)\nrf_grid_lng.fit(xtrain, ytrain_lng)\nrf_grid_lng.best_params_","metadata":{"execution":{"iopub.status.busy":"2021-06-19T17:43:02.966164Z","iopub.execute_input":"2021-06-19T17:43:02.966481Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"rf_grid_lng.cv_results_","metadata":{"execution":{"iopub.status.busy":"2021-06-19T17:37:09.212418Z","iopub.execute_input":"2021-06-19T17:37:09.212759Z","iopub.status.idle":"2021-06-19T17:37:09.221981Z","shell.execute_reply.started":"2021-06-19T17:37:09.212729Z","shell.execute_reply":"2021-06-19T17:37:09.221132Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"rf_lng = GradientBoostingRegressor(n_estimators = 300, max_depth = 20)\nrf_lng.fit(xtrain_lng, ytrain_lng)\nypred_lng = rf_lng.predict(xtest_lng)","metadata":{"execution":{"iopub.status.busy":"2021-06-19T13:53:34.251128Z","iopub.execute_input":"2021-06-19T13:53:34.251565Z","iopub.status.idle":"2021-06-19T14:00:02.952031Z","shell.execute_reply.started":"2021-06-19T13:53:34.251523Z","shell.execute_reply":"2021-06-19T14:00:02.951223Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#code fore adding phone to the test data\nytest_lat = ytest[['latDeg_truth','lngDeg_truth']]\n#ytest_lat.head()\nytest_lat['millisSinceGpsEpoch'] = traindata['millisSinceGpsEpoch']\n#ytest_lat.head()\nytest_lat['phone'] = traindata['phone']\nytest_lat.head()","metadata":{"execution":{"iopub.status.busy":"2021-06-19T14:00:21.103357Z","iopub.execute_input":"2021-06-19T14:00:21.104205Z","iopub.status.idle":"2021-06-19T14:00:21.128148Z","shell.execute_reply.started":"2021-06-19T14:00:21.104154Z","shell.execute_reply":"2021-06-19T14:00:21.127037Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ytest_lat.reset_index(inplace = True)\nytest_lat = ytest_lat.drop(['index'], axis = 1)\n#ytest_lat.head()\n\nytest_lat['latDeg_pred'] = pd.Series(ypred_lat)\nytest_lat['lngDeg_pred'] = pd.Series(ypred_lng)\nytest_lat.head()","metadata":{"execution":{"iopub.status.busy":"2021-06-19T14:00:26.977573Z","iopub.execute_input":"2021-06-19T14:00:26.977953Z","iopub.status.idle":"2021-06-19T14:00:26.998213Z","shell.execute_reply.started":"2021-06-19T14:00:26.977922Z","shell.execute_reply":"2021-06-19T14:00:26.997199Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ytest_lat['lngDeg_truth'][5]","metadata":{"execution":{"iopub.status.busy":"2021-06-18T15:46:53.305131Z","iopub.execute_input":"2021-06-18T15:46:53.305671Z","iopub.status.idle":"2021-06-18T15:46:53.312044Z","shell.execute_reply.started":"2021-06-18T15:46:53.305624Z","shell.execute_reply":"2021-06-18T15:46:53.311318Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#cacluating the havesine distance\nfrom math import radians, cos, sin, asin, sqrt\ndef haversine(df):\n    dist = []\n    for i in df.index:\n        lat1 = df['latDeg_truth'][i]\n        lng1 = df['lngDeg_truth'][i]\n        lat2 = df['latDeg_pred'][i]\n        lng2 = df['lngDeg_pred'][i]\n        # convert decimal degrees to radians \n        lat1,lng1,lat2,lng2 = map(radians, [lat1, lng1, lat2, lng2])\n\n        # haversine formula \n        dlon = lng2 - lng1 \n        dlat = lat2 - lat1 \n        a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2\n        c = 2 * asin(sqrt(a)) \n        r = 6371000 # Radius of earth in kilometers. Use 3956 for miles\n        d = c * r\n        dist.append(d)\n    return dist","metadata":{"execution":{"iopub.status.busy":"2021-06-19T14:00:37.231937Z","iopub.execute_input":"2021-06-19T14:00:37.232275Z","iopub.status.idle":"2021-06-19T14:00:37.239784Z","shell.execute_reply.started":"2021-06-19T14:00:37.232246Z","shell.execute_reply":"2021-06-19T14:00:37.238689Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ytest_lat['dist'] = haversine(ytest_lat)\nytest_lat.head()","metadata":{"execution":{"iopub.status.busy":"2021-06-19T14:00:43.114796Z","iopub.execute_input":"2021-06-19T14:00:43.115371Z","iopub.status.idle":"2021-06-19T14:00:44.559442Z","shell.execute_reply.started":"2021-06-19T14:00:43.11532Z","shell.execute_reply":"2021-06-19T14:00:44.558698Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ytest_lat.head()","metadata":{"execution":{"iopub.status.busy":"2021-06-12T14:53:53.191093Z","iopub.execute_input":"2021-06-12T14:53:53.191397Z","iopub.status.idle":"2021-06-12T14:53:53.204674Z","shell.execute_reply.started":"2021-06-12T14:53:53.191369Z","shell.execute_reply":"2021-06-12T14:53:53.203732Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#xtest.head()\n#xdata.head()\n#final_df = pd.DataFrame()\nytest_pred_df = ytest_lat.groupby(['phone']).dist.apply(lambda x: np.percentile(x,50)).reset_index()\nytest_pred_df.head()\nlen(ytest_pred_df)\n\n#df.groupby(['group'])['price'].apply(lambda x: np.percentile(x,60))\n#ytest_lat.head()","metadata":{"execution":{"iopub.status.busy":"2021-06-19T14:00:53.497772Z","iopub.execute_input":"2021-06-19T14:00:53.49827Z","iopub.status.idle":"2021-06-19T14:00:53.532278Z","shell.execute_reply.started":"2021-06-19T14:00:53.498239Z","shell.execute_reply":"2021-06-19T14:00:53.53132Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ytest_pred_df1 = ytest_lat.groupby(['phone']).dist.apply(lambda x: np.percentile(x,95)).reset_index()\nytest_pred_df1.head()","metadata":{"execution":{"iopub.status.busy":"2021-06-19T14:00:55.663992Z","iopub.execute_input":"2021-06-19T14:00:55.664551Z","iopub.status.idle":"2021-06-19T14:00:55.701751Z","shell.execute_reply.started":"2021-06-19T14:00:55.664494Z","shell.execute_reply":"2021-06-19T14:00:55.70073Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ytest_pred_df['dist_95'] = ytest_pred_df1['dist']\navg_dist = []\nfor i in ytest_pred_df.index:\n    a = (ytest_pred_df['dist'][i] + ytest_pred_df['dist_95'][i])/2\n    avg_dist.append(a)\navg_dist\nytest_pred_df['avg_dist'] = avg_dist","metadata":{"execution":{"iopub.status.busy":"2021-06-19T14:01:01.057341Z","iopub.execute_input":"2021-06-19T14:01:01.057705Z","iopub.status.idle":"2021-06-19T14:01:01.065885Z","shell.execute_reply.started":"2021-06-19T14:01:01.057674Z","shell.execute_reply":"2021-06-19T14:01:01.0649Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#ytest_pred_df = ytest_pred_df.drop(['avg_dist'], axis = 1)\nytest_pred_df.head()","metadata":{"execution":{"iopub.status.busy":"2021-06-18T15:48:52.921999Z","iopub.execute_input":"2021-06-18T15:48:52.922544Z","iopub.status.idle":"2021-06-18T15:48:52.933867Z","shell.execute_reply.started":"2021-06-18T15:48:52.922503Z","shell.execute_reply":"2021-06-18T15:48:52.932933Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#final average\nk = 0\ns = 0\nfor i in ytest_pred_df.index:\n    k = k + 1\n    s = s + ytest_pred_df['avg_dist'][i]\n\nl = s/k\nprint(\"overall average error across phones: %.5f\", {l})","metadata":{"execution":{"iopub.status.busy":"2021-06-19T14:01:06.981226Z","iopub.execute_input":"2021-06-19T14:01:06.981789Z","iopub.status.idle":"2021-06-19T14:01:06.989006Z","shell.execute_reply.started":"2021-06-19T14:01:06.981741Z","shell.execute_reply":"2021-06-19T14:01:06.988129Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission = pd.read_csv(\"../input/google-smartphone-decimeter-challenge/sample_submission.csv\")\nsubmission.head()","metadata":{"execution":{"iopub.status.busy":"2021-06-12T15:10:57.766324Z","iopub.execute_input":"2021-06-12T15:10:57.76666Z","iopub.status.idle":"2021-06-12T15:10:57.918368Z","shell.execute_reply.started":"2021-06-12T15:10:57.76663Z","shell.execute_reply":"2021-06-12T15:10:57.917676Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cols2 = ['collectionName','phoneName','millisSinceGpsEpoch','constellationType','svid','signalType','receivedSvTimeInGpsNanos','xSatPosM','ySatPosM','zSatPosM']\nlogs = (datapath/'test').rglob('*derived.csv')\n\nlogslist = []\nfor fpath in logs:\n    logcsv = pd.read_csv(fpath, usecols = cols2)\n    logslist.append(logcsv)\n\nlogsdata_test = pd.concat(logslist, ignore_index = True)","metadata":{"execution":{"iopub.status.busy":"2021-06-19T14:01:23.521872Z","iopub.execute_input":"2021-06-19T14:01:23.522365Z","iopub.status.idle":"2021-06-19T14:01:35.413962Z","shell.execute_reply.started":"2021-06-19T14:01:23.522335Z","shell.execute_reply":"2021-06-19T14:01:35.41291Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Add the additional columns from derived csv files","metadata":{"editable":false}},{"cell_type":"code","source":"logsdata_svtime = logsdata_test.groupby(['collectionName','phoneName','millisSinceGpsEpoch']).receivedSvTimeInGpsNanos.apply(lambda x: np.min(x)).reset_index()\nlogsdata_xsat = logsdata_test.groupby(['collectionName','phoneName','millisSinceGpsEpoch']).xSatPosM.apply(lambda x: np.average(x)).reset_index()\nlogsdata_ysat = logsdata_test.groupby(['collectionName','phoneName','millisSinceGpsEpoch']).ySatPosM.apply(lambda x: np.average(x)).reset_index()\nlogsdata_zsat = logsdata_test.groupby(['collectionName','phoneName','millisSinceGpsEpoch']).zSatPosM.apply(lambda x: np.average(x)).reset_index()\nlogsdata_svid = logsdata_test.groupby(['collectionName','phoneName','millisSinceGpsEpoch']).svid.apply(lambda x: x.value_counts().index[0]).reset_index()\n#logsdata_constellation = logsdata_test.groupby(['collectionName','phoneName','millisSinceGpsEpoch']).constellationType.apply(lambda x:x.value_counts().index[0]).reset_index()\nlogsdata_signaltype = logsdata_test.groupby(['collectionName','phoneName','millisSinceGpsEpoch']).signalType.apply(lambda x: x.value_counts().index[0]).reset_index()\n\nlogsdata1 = logsdata_svtime.merge(logsdata_xsat, on = ['collectionName','phoneName','millisSinceGpsEpoch'])\nlogsdata2 = logsdata1.merge(logsdata_ysat, on = ['collectionName','phoneName','millisSinceGpsEpoch'])\nlogsdata3 = logsdata2.merge(logsdata_zsat, on = ['collectionName','phoneName','millisSinceGpsEpoch'])\nlogsdata4 = logsdata3.merge(logsdata_svid, on = ['collectionName','phoneName','millisSinceGpsEpoch'])\n#logsdata5 = logsdata4.merge(logsdata_constellation, on = ['collectionName','phoneName','millisSinceGpsEpoch'])\nlogsdata_test_final = logsdata4.merge(logsdata_signaltype, on = ['collectionName','phoneName','millisSinceGpsEpoch'])\n#logsdata_final['constellationType'] = logsdata_final.constellationType.apply(lambda x: \"one\" if x == 1 else(\"two\" if x == 2 else(\"three\" if x == 3 else(\"four\" if x == 4 else(\"five\" if x == 5 else(\"six\" if x == 6 else \"zero\"))))))                                                                                                 \nlogsdata_test_final.head()","metadata":{"execution":{"iopub.status.busy":"2021-06-19T14:01:41.705744Z","iopub.execute_input":"2021-06-19T14:01:41.706115Z","iopub.status.idle":"2021-06-19T14:03:32.115695Z","shell.execute_reply.started":"2021-06-19T14:01:41.706085Z","shell.execute_reply":"2021-06-19T14:03:32.114951Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"len(xtrain_lat)","metadata":{"execution":{"iopub.status.busy":"2021-06-18T16:22:47.634481Z","iopub.execute_input":"2021-06-18T16:22:47.634882Z","iopub.status.idle":"2021-06-18T16:22:47.641398Z","shell.execute_reply.started":"2021-06-18T16:22:47.634847Z","shell.execute_reply":"2021-06-18T16:22:47.640139Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#traindata = trainfile.merge(truthdata, on = cols1[:3], suffixes=(\"_current\",\"_truth\")) # merge train file with observed data\n#testdata = testfile.merge(logsdata_test_final, on = cols1[:3]) # add columns from gnss logs to the traindata\ntestdata = pd.DataFrame()\nprint(len(testfile))\nprint(len(logsdata_test_final))\ntestdata = pd.merge(testfile, logsdata_test_final, how = 'left', on = ['collectionName','phoneName','millisSinceGpsEpoch'])\nprint(len(testdata))\ntestdata.tail()","metadata":{"execution":{"iopub.status.busy":"2021-06-19T14:03:43.638283Z","iopub.execute_input":"2021-06-19T14:03:43.638652Z","iopub.status.idle":"2021-06-19T14:03:43.763304Z","shell.execute_reply.started":"2021-06-19T14:03:43.638622Z","shell.execute_reply":"2021-06-19T14:03:43.762308Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"testdata['receivedSvTimeInGpsNanos'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2021-06-19T12:27:17.254299Z","iopub.execute_input":"2021-06-19T12:27:17.254708Z","iopub.status.idle":"2021-06-19T12:27:17.268604Z","shell.execute_reply.started":"2021-06-19T12:27:17.254673Z","shell.execute_reply":"2021-06-19T12:27:17.267444Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"testdata = testdata.fillna(0)\ntestdata['svid'] = pd.Categorical(testdata.svid)\n#testdata['constellationType'] = pd.Categorical(testdata.constellationType) \ntestdata['signalType'] = pd.Categorical(testdata.signalType)\ntestdata.iloc[:, 3:].corr()","metadata":{"execution":{"iopub.status.busy":"2021-06-19T13:08:39.174045Z","iopub.execute_input":"2021-06-19T13:08:39.174446Z","iopub.status.idle":"2021-06-19T13:08:39.268353Z","shell.execute_reply.started":"2021-06-19T13:08:39.174411Z","shell.execute_reply":"2021-06-19T13:08:39.267252Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"","metadata":{"editable":false}},{"cell_type":"markdown","source":"Create the columns needed for making prediction","metadata":{"editable":false}},{"cell_type":"code","source":"testdata.rename(columns = {'latDeg': 'latDeg_current', 'lngDeg': 'lngDeg_current'}, inplace = True)\ntestdata.sort_values(by = ['phone','millisSinceGpsEpoch'])\n#testdata = testdata.fillna(0)\ntestdata['latDeg_prev'] = testdata['latDeg_current'].shift(1).where(testdata['phone'].eq(testdata['phone'].shift(1)))\ntestdata['lngDeg_prev'] = testdata['lngDeg_current'].shift(1).where(testdata['phone'].eq(testdata['phone'].shift(1)))    \ntestdata['latDeg_next'] = testdata['latDeg_current'].shift(-1).where(testdata['phone'].eq(testdata['phone'].shift(-1)))\ntestdata['lngDeg_next'] = testdata['lngDeg_current'].shift(-1).where(testdata['phone'].eq(testdata['phone'].shift(-1)))\ntestdata['time_prev'] = testdata['millisSinceGpsEpoch'].shift(1).where(testdata['phone'].eq(testdata['phone'].shift(1)))\ntestdata['time_next'] = testdata['millisSinceGpsEpoch'].shift(-1).where(testdata['phone'].eq(testdata['phone'].shift(-1)))\n\nfor i in testdata.index:\n    if pd.isna(testdata['latDeg_prev'][i]):\n        testdata['latDeg_prev'][i] = testdata['latDeg_current'][i]\n        testdata['lngDeg_prev'][i] = testdata['lngDeg_current'][i]\n        testdata['time_prev'][i] = testdata['millisSinceGpsEpoch'][i]\n    if pd.isna(testdata['latDeg_next'][i]):\n        testdata['latDeg_next'][i] = testdata['latDeg_current'][i]\n        testdata['lngDeg_next'][i] = testdata['lngDeg_current'][i]\n        testdata['time_next'][i] = testdata['millisSinceGpsEpoch'][i]\n    \ntestdata['time_since_last_read'] = testdata['millisSinceGpsEpoch'] - testdata['time_prev']\nprint(len(testdata))\n#print(len(trainfile))\ntestdata.head()","metadata":{"execution":{"iopub.status.busy":"2021-06-19T14:04:39.088943Z","iopub.execute_input":"2021-06-19T14:04:39.089287Z","iopub.status.idle":"2021-06-19T14:04:41.261564Z","shell.execute_reply.started":"2021-06-19T14:04:39.089259Z","shell.execute_reply":"2021-06-19T14:04:41.260475Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"testdata['receivedSvTimeInGpsNanos'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2021-06-19T13:16:36.876295Z","iopub.execute_input":"2021-06-19T13:16:36.876676Z","iopub.status.idle":"2021-06-19T13:16:36.891573Z","shell.execute_reply.started":"2021-06-19T13:16:36.876644Z","shell.execute_reply":"2021-06-19T13:16:36.890387Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\n#x_cols = ['latDeg_current','lngDeg_current','heightAboveWgs84EllipsoidM','latDeg_prev', 'latDeg_next', 'lngDeg_prev', 'lngDeg_next','time_since_last_read','xSatPosM','ySatPosM','zSatPosM','receivedSvTimeInGpsNanos']\n#len(x_cols)\ntest_cols = [x for x in x_cols if x not in ('latDeg_truth','lngDeg_truth')]\nxdata_test = testdata[test_cols] #creating the x variable df\n#xdata_test.head() # dummies for the categorical variable\nxdata_test_dummies = pd.get_dummies(xdata_test, prefix = \"dum_\")\nxdata_test_dummies.columns","metadata":{"execution":{"iopub.status.busy":"2021-06-19T14:07:12.278819Z","iopub.execute_input":"2021-06-19T14:07:12.279188Z","iopub.status.idle":"2021-06-19T14:07:12.310615Z","shell.execute_reply.started":"2021-06-19T14:07:12.279156Z","shell.execute_reply":"2021-06-19T14:07:12.309558Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"xdata_test_dummies.head()\nxdata_test_dummies = xdata_test_dummies.fillna(0)","metadata":{"execution":{"iopub.status.busy":"2021-06-19T14:08:27.558612Z","iopub.execute_input":"2021-06-19T14:08:27.558987Z","iopub.status.idle":"2021-06-19T14:08:27.569067Z","shell.execute_reply.started":"2021-06-19T14:08:27.558958Z","shell.execute_reply":"2021-06-19T14:08:27.568054Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#arrange the columns correctly\ncol_list_train = [c for c in xtrain.columns]\nxdata_test_dummies1 = pd.DataFrame()\nfor c in xtrain.columns:\n    if c in xdata_test_dummies.columns:\n        xdata_test_dummies1[c] = xdata_test_dummies[c]\n    else:\n        xdata_test_dummies1[c] = 0\n\nxdata_test_dummies1.head()","metadata":{"execution":{"iopub.status.busy":"2021-06-19T14:08:52.945114Z","iopub.execute_input":"2021-06-19T14:08:52.945467Z","iopub.status.idle":"2021-06-19T14:08:53.003537Z","shell.execute_reply.started":"2021-06-19T14:08:52.945437Z","shell.execute_reply":"2021-06-19T14:08:53.002456Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"clen = len(xtrain.columns)\nxtraincols = [c for c in xtrain.columns]\nxtestcols = [c for c in xdata_test_dummies1.columns]\nfor i in range(clen):\n    if xtraincols[i] != xtestcols[i]:\n        print(xtestcols[i])\nif len(xtraincols) != len(xtestcols):\n    print(\"array len mismatch\")","metadata":{"execution":{"iopub.status.busy":"2021-06-19T14:09:03.5033Z","iopub.execute_input":"2021-06-19T14:09:03.503658Z","iopub.status.idle":"2021-06-19T14:09:03.509383Z","shell.execute_reply.started":"2021-06-19T14:09:03.503626Z","shell.execute_reply":"2021-06-19T14:09:03.508348Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"xtrain_lat.columns","metadata":{"execution":{"iopub.status.busy":"2021-06-19T13:21:55.972605Z","iopub.execute_input":"2021-06-19T13:21:55.973218Z","iopub.status.idle":"2021-06-19T13:21:55.980653Z","shell.execute_reply.started":"2021-06-19T13:21:55.973164Z","shell.execute_reply":"2021-06-19T13:21:55.97948Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"xtest_lat.describe()","metadata":{"execution":{"iopub.status.busy":"2021-06-18T16:27:08.2495Z","iopub.execute_input":"2021-06-18T16:27:08.249917Z","iopub.status.idle":"2021-06-18T16:27:08.598787Z","shell.execute_reply.started":"2021-06-18T16:27:08.249852Z","shell.execute_reply":"2021-06-18T16:27:08.597796Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cols = list(xdata_test_dummies1.columns)\nlatcols = [e for e in cols if e not in ('lngDeg_current','lngDeg_prev','lngDeg_next','latDeg_truth','lngDeg_truth')]\nlngcols = [e for e in cols if e not in ('latDeg_current','latDeg_prev','latDeg_next','latDeg_truth','lngDeg_truth')]\nxtest_lat = xdata_test_dummies[latcols]\nxtest_lng = xdata_test_dummies[lngcols]\nlat_pred = rf_lat.predict(xtest_lat)\nxdata_test['latDeg'] = pd.Series(lat_pred)\nlng_pred = rf_lng.predict(xtest_lng)\nxdata_test['lngDeg'] = pd.Series(lng_pred)\nxdata_test.head()","metadata":{"execution":{"iopub.status.busy":"2021-06-19T14:16:58.318726Z","iopub.execute_input":"2021-06-19T14:16:58.319095Z","iopub.status.idle":"2021-06-19T14:17:03.689874Z","shell.execute_reply.started":"2021-06-19T14:16:58.319066Z","shell.execute_reply":"2021-06-19T14:17:03.689134Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"xtest_lng.head()","metadata":{"execution":{"iopub.status.busy":"2021-06-19T14:16:15.261546Z","iopub.execute_input":"2021-06-19T14:16:15.261919Z","iopub.status.idle":"2021-06-19T14:16:15.285378Z","shell.execute_reply.started":"2021-06-19T14:16:15.261887Z","shell.execute_reply":"2021-06-19T14:16:15.28442Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#testdata.head()\n#testdata = testdata.rename({'latDeg': 'latDeg_current', 'lngDeg': 'lngDeg_current'}, axis=1)\n#testdata.head()\ntestdata['latDeg'] = xdata_test['latDeg']\ntestdata['lngDeg'] = xdata_test['lngDeg']\ncollist_sub = ['phone','millisSinceGpsEpoch','latDeg','lngDeg']\nsubdata = testdata[collist_sub]\nsubdata.head()","metadata":{"execution":{"iopub.status.busy":"2021-06-19T14:18:28.786707Z","iopub.execute_input":"2021-06-19T14:18:28.787241Z","iopub.status.idle":"2021-06-19T14:18:28.803374Z","shell.execute_reply.started":"2021-06-19T14:18:28.787191Z","shell.execute_reply":"2021-06-19T14:18:28.802453Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"subdata.to_csv('./submissions_v3.csv', index = False)","metadata":{"execution":{"iopub.status.busy":"2021-06-19T14:11:32.655008Z","iopub.execute_input":"2021-06-19T14:11:32.655357Z","iopub.status.idle":"2021-06-19T14:11:33.283695Z","shell.execute_reply.started":"2021-06-19T14:11:32.655327Z","shell.execute_reply":"2021-06-19T14:11:33.282549Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!kaggle competitions submit -c google-smartphone-decimeter-challenge -f 'submissions_v3.csv' -m \"Message\"","metadata":{"execution":{"iopub.status.busy":"2021-06-19T14:12:57.195326Z","iopub.execute_input":"2021-06-19T14:12:57.195718Z","iopub.status.idle":"2021-06-19T14:12:58.439517Z","shell.execute_reply.started":"2021-06-19T14:12:57.195681Z","shell.execute_reply":"2021-06-19T14:12:58.438686Z"},"editable":false,"trusted":true},"execution_count":null,"outputs":[]}]}