{"cells":[{"metadata":{"id":"TQtx2FPG3cfc","colab_type":"text"},"cell_type":"markdown","source":"# Loading in required packages and the data"},{"metadata":{"id":"Gleldst48G7h","colab_type":"code","colab":{},"trusted":true},"cell_type":"code","source":"#For data manipulaiton\nimport pandas as pd\n\n#For linear algebra\nimport numpy as np\n\n#For plotting\nimport matplotlib.pyplot as plt\n\nimport seaborn as sns\n%matplotlib inline\n\n#Not sure what this is used for\nfrom scipy import stats\n\n#Used for specific mathematical functions\nimport math\n\n#to calculate skewness and kurtosis\nfrom scipy.stats import skew\nfrom scipy.stats import kurtosis\nfrom scipy.stats import moment\nfrom scipy.stats import iqr\n\n# The distance \nfrom scipy.spatial.distance import euclidean\n\n#Used for tracking progress of for loops\nfrom tqdm import tqdm\n\n#for suppressing warnings\nimport warnings\nwarnings.filterwarnings('ignore')\n\n#The paths of the data\n#Test_Path = '/content/gdrive/My Drive/Personal/EY Data Science Challange/data/test.csv'\n#Train_Path = '/content/gdrive/My Drive/Personal/EY Data Science Challange/data/train.csv'\n\n#Alternative paths\n#Train_Path = '/content/gdrive/My Drive/EY Data Science Challange/data/train.csv'\n#Test_Path = '/content/gdrive/My Drive/EY Data Science Challange/data/test.csv'\n\n#Kaggle paths\nTrain_Path = '../input/data_train.csv'\nTest_Path = '../input/data_test.csv'","execution_count":null,"outputs":[]},{"metadata":{"id":"k7SOz8GL8qwc","colab_type":"code","colab":{},"trusted":true},"cell_type":"code","source":"#Training and testing data\ndf_train = pd.read_csv(Train_Path)\ndf_test = pd.read_csv(Test_Path)\n\n#Drop the unnecessary index columnd\ndf_train = df_train.drop(\"Unnamed: 0\", axis= 1)\ndf_test  = df_test.drop(\"Unnamed: 0\", axis= 1)","execution_count":null,"outputs":[]},{"metadata":{"id":"-OipPRAdeChL","colab_type":"code","colab":{},"trusted":true},"cell_type":"code","source":"#Specifying the city edge limits so that we don't have to type them later on.\nx_min =3750901.5068\nx_max = 3770901.5068\ny_min = -19268905.6133\ny_max = -19208905.6133\nwidth = x_max - x_min\nheight = y_max - y_min","execution_count":null,"outputs":[]},{"metadata":{"id":"8mxnDGO0ykLX","colab_type":"code","colab":{},"trusted":true},"cell_type":"code","source":"df_train['Is_V_NOT_NULL'] = np.where(df_train['vmean']>=0,1,0)\ndf_test['Is_V_NOT_NULL'] = np.where(df_test['vmean']>=0,1,0)\n\ndf_train['Is_V_minus'] = np.where(df_train['vmean']<0,1,0)\ndf_test['Is_V_minus'] = np.where(df_test['vmean']<0,1,0)","execution_count":null,"outputs":[]},{"metadata":{"id":"GXUQL28_3h0D","colab_type":"text"},"cell_type":"markdown","source":"# Defining Functions which will be used to make changes to the data"},{"metadata":{"id":"fT_BZz4NAVuk","colab_type":"code","outputId":"3597f70d-6133-49da-8ed3-95e6e81fa2c2","colab":{"base_uri":"https://localhost:8080/","height":34},"trusted":true},"cell_type":"code","source":"#Turns the time_entry and time_exit columns to seconds\ndef HHMMSS_int(t):\n  (h, m, s) = t.split(':')\n  return int(h) * 3600 + int(m) * 60 + int(s)\n\n#Calculates the distance between points\ndef Distance(a,b,c,d):\n  hor = a-b\n  ver = c-d\n  return (hor**2+ver**2)**0.5\n\n#Calculates the direction an individual is travelling\ndef Direction(a,b,c,d):\n  pointA = (a,b)\n  pointB = (c,d)\n  \n  lat1 = math.radians(pointA[0])\n  lat2 = math.radians(pointB[0])\n\n  diffLong = math.radians(pointB[1] - pointA[1])\n\n  x = math.sin(diffLong) * math.cos(lat2)\n  y = math.cos(lat1) * math.sin(lat2) - (math.sin(lat1)\n  * math.cos(lat2) * math.cos(diffLong))\n\n  initial_bearing = math.atan2(x, y)\n\n  # Now we have the initial bearing but math.atan2 return values\n  # from -180° to + 180° which is not what we want for a compass bearing\n  # The solution is to normalize the initial bearing as shown below\n  initial_bearing = math.degrees(initial_bearing)\n  compass_bearing = (initial_bearing + 360) % 360\n\n  return compass_bearing\n\n#Checks if an individual is the city\ndef InCity(a,b):\n  a = list(a)\n  b = list(b)\n  x = []\n  for i in range(len(a)):\n    cond = ((3750901.5068 <= a[i] <= 3770901.5068) and (-19268905.6133<= b[i]<=-19208905.6133)) #Found the issue in this function. Had the y limits mixed up initially.\n    if cond:\n      x.append(1)\n    else:\n      x.append(0)\n  return x\n\nprint('done')","execution_count":null,"outputs":[]},{"metadata":{"id":"Yx6dwvPQ3klg","colab_type":"text"},"cell_type":"markdown","source":"# Making new variables for the existitng dataset"},{"metadata":{"id":"nwKFDVzL2jYl","colab_type":"code","outputId":"13f92fe8-dd7b-40fa-f888-c0f3aa96042c","colab":{"base_uri":"https://localhost:8080/","height":34},"trusted":true},"cell_type":"code","source":"#Turn time_entry and time_exit to secodns and also making a new variable calculating the between between entry and exit for a trajectory\ndf_train['time_entry_secs'] = df_train['time_entry'].map(lambda x : HHMMSS_int(x))\ndf_train['time_exit_secs'] = df_train['time_exit'].map(lambda x : HHMMSS_int(x))\ndf_train['Time_stayed_secs'] = df_train['time_exit_secs']-df_train['time_entry_secs']\n\n#Make a variable which captures if the individual was in the city at the time of exit\ndf_train['In_City'] = InCity(df_train['x_exit'],df_train['y_exit'])\n\n\n#The code below will be used to calculate the Bearings(direction the individual is travelling in) and Distance travelled variables\na = list(df_train['x_entry'])\nb = list(df_train['y_entry'])\nc = list(df_train['x_exit'])\nd = list(df_train['y_exit']) \nBearings = []\nDistanceL = []\n\n\n\nfor i in tqdm(range(len(a))):\n  Bearings.append(Direction(a[i],b[i],c[i],d[i]))\n  DistanceL.append(Distance(a[i],c[i],b[i],d[i]))      #Taku: Made a change to the input order. Initially it was a,b,c,d. Changed it to a,c,d,b so that it matches \n\nBearings = pd.DataFrame(Bearings, columns = ['Bearings'])\nDistanceL = pd.DataFrame(DistanceL, columns = ['Euclidean_Distance'])\n\ndf_train = pd.concat([df_train, Bearings, DistanceL], axis=1)","execution_count":null,"outputs":[]},{"metadata":{"id":"iYYjFCM-VpH3","colab_type":"text"},"cell_type":"markdown","source":"Do the same thing for the test set"},{"metadata":{"id":"LIkYWGwQVgbf","colab_type":"code","outputId":"7f7dd8fa-39b3-4c4e-af9d-3f7e27f62878","colab":{"base_uri":"https://localhost:8080/","height":34},"trusted":true},"cell_type":"code","source":"#Turn time_entry and time_exit to secodns and also making a new variable calculating the between between entry and exit for a trajectory\ndf_test['time_entry_secs'] = df_test['time_entry'].map(lambda x : HHMMSS_int(x))\ndf_test['time_exit_secs'] = df_test['time_exit'].map(lambda x : HHMMSS_int(x))\ndf_test['Time_stayed_secs'] = df_test['time_exit_secs']-df_test['time_entry_secs']\n\n#Make a variable which captures if the individual was in the city at the time of exit\ndf_test['In_City'] = InCity(df_test['x_exit'],df_test['y_exit'])\n\n\n#The code below will be used to calculate the Bearings(direction the individual is travelling in) and Distance travelled variables\na = list(df_test['x_entry'])\nb = list(df_test['y_entry'])\nc = list(df_test['x_exit'])\nd = list(df_test['y_exit']) \nBearings = []\nDistanceL = []\n\n\n\nfor i in tqdm(range(len(a))):\n  Bearings.append(Direction(a[i],b[i],c[i],d[i]))\n  DistanceL.append(Distance(a[i],c[i],b[i],d[i]))      #Taku: Made a change to the input order. Initially it was a,b,c,d. Changed it to a,c,d,b so that it matches \n\nBearings = pd.DataFrame(Bearings, columns = ['Bearings'])\nDistanceL = pd.DataFrame(DistanceL, columns = ['Euclidean_Distance'])\n\ndf_test = pd.concat([df_test, Bearings, DistanceL], axis=1)","execution_count":null,"outputs":[]},{"metadata":{"id":"YA862psW4GjD","colab_type":"code","colab":{},"trusted":true},"cell_type":"code","source":"#Make a new variable capturing speed\ndf_train['Euclidean_Speed'] = np.array(df_train['Euclidean_Distance'])/np.array(df_train['Time_stayed_secs'])\ndf_train['Euclidean_Speed'] = df_train['Euclidean_Speed'].replace(np.inf,0)\ndf_test['Euclidean_Speed'] = np.array(df_test['Euclidean_Distance'])/np.array(df_test['Time_stayed_secs'])\ndf_test['Euclidean_Speed'] = df_test['Euclidean_Speed'].replace(np.inf,0)","execution_count":null,"outputs":[]},{"metadata":{"id":"1cVYRjX83aTG","colab_type":"code","colab":{},"trusted":true},"cell_type":"code","source":"#Making a variable which contains the hour of day when an individual's time of entry was caputred\ndf_train['hour_of_day'] = df_train['time_entry'].map(lambda x : int(x.split(':')[0]))\ndf_test['hour_of_day'] = df_test['time_entry'].map(lambda x : int(x.split(':')[0]))","execution_count":null,"outputs":[]},{"metadata":{"id":"SzCA9mWhIcIU","colab_type":"code","colab":{},"trusted":true},"cell_type":"code","source":"#Make the last number in the hash number into a factor\ndf_train['New_Hash_Var_1'] = df_train.hash.map(lambda x:np.float(x[-1]))\ndf_test['New_Hash_Var_1'] = df_test.hash.map(lambda x:np.float(x[-1]))","execution_count":null,"outputs":[]},{"metadata":{"id":"CW7Wb9D-oyML","colab_type":"code","outputId":"76071676-f318-40e2-c6bf-5ee317876dbc","colab":{"base_uri":"https://localhost:8080/","height":34},"trusted":true},"cell_type":"code","source":"###Sperical_Distance for training data\n\n#Make list of potential desired columns\ndistances = ['x_entry', 'y_entry','x_exit', 'y_exit']\nentry = ['x_entry', 'y_entry']\nexit = ['x_exit', 'y_exit']\n\nradius = 3963 #In miles\n\n#Store the entry and exisst coordinates in seperata vectors\nentry_vector = pd.Series(list(df_train[entry].values)).map(lambda x:np.array(x))\nexit_vector = pd.Series(list(df_train[exit].values)).map(lambda x:np.array(x))\n\ndistances_vector = list()\nfor i in tqdm(range(len(entry_vector))):\n\n  #Entry and exit points\n  entry = tuple(entry_vector[i])\n  exit =  tuple(exit_vector[i])\n  \n  #Abs change in k\n  abs_change_in_k = np.abs(entry[1] - exit[1])\n  \n  \n  #change in sigma\n  triangle_sigma = np.arccos(np.sin(entry[0])*np.sin(exit[0]) + np.cos(entry[0])*np.cos(exit[0])*np.cos(abs_change_in_k))\n  \n  #Calculate spherical distance\n  distance = radius*triangle_sigma\n  distances_vector.append(distance)\n  \n#Add in a new column with this type of speed\ndf_train['Spherical_Distance'] = distances_vector","execution_count":null,"outputs":[]},{"metadata":{"id":"Y3QqFOssuC85","colab_type":"code","outputId":"065c68e8-a3ef-40be-fd74-2ef8aab95db9","colab":{"base_uri":"https://localhost:8080/","height":34},"trusted":true},"cell_type":"code","source":"###Sperical_Distance for testing data\n\n#Make list of potential desired columns\ndistances = ['x_entry', 'y_entry','x_exit', 'y_exit']\nentry = ['x_entry', 'y_entry']\nexit = ['x_exit', 'y_exit']\n\nradius = 3963 #In miles\n\n#Store the entry and exisst coordinates in seperata vectors\nentry_vector = pd.Series(list(df_test[entry].values)).map(lambda x:np.array(x))\nexit_vector = pd.Series(list(df_test[exit].values)).map(lambda x:np.array(x))\n\n#Make a list to store the distances\ndistances_vector = list()\n\nfor i in tqdm(range(len(entry_vector))):\n\n  #Entry and exit points\n  entry = tuple(entry_vector[i])\n  exit =  tuple(exit_vector[i])\n  \n  #Abs change in k\n  abs_change_in_k = np.abs(entry[1] - exit[1])\n  \n  \n  #change in sigma\n  triangle_sigma = np.arccos(np.sin(entry[0])*np.sin(exit[0]) + np.cos(entry[0])*np.cos(exit[0])*np.cos(abs_change_in_k))\n  \n  #Calculate spherical distance\n  distance = radius*triangle_sigma\n  distances_vector.append(distance)\n  \n#Add in a new column with this type of speed\ndf_test['Spherical_Distance'] = distances_vector","execution_count":null,"outputs":[]},{"metadata":{"id":"edkX68IOtUqb","colab_type":"code","colab":{},"trusted":true},"cell_type":"code","source":"#Make a new variable capturing speed\ndf_train['Spherical_Speed'] = np.array(df_train['Spherical_Distance'])/np.array(df_train['Time_stayed_secs'])\ndf_train['Spherical_Speed'] = df_train['Spherical_Speed'].replace(np.inf,0)\ndf_test['Spherical_Speed'] = np.array(df_test['Spherical_Distance'])/np.array(df_test['Time_stayed_secs'])\ndf_test['Spherical_Speed'] = df_test['Spherical_Speed'].replace(np.inf,0)","execution_count":null,"outputs":[]},{"metadata":{"id":"pbOV8cK15nxr","colab_type":"code","colab":{},"trusted":true},"cell_type":"code","source":"#The city centre\nx_centre = (x_max + x_min)/2\ny_centre = (y_max + y_min)/2\ncity_centre = (x_centre,y_centre)","execution_count":null,"outputs":[]},{"metadata":{"id":"u0lWEsjf59fa","colab_type":"code","outputId":"d7aa4075-abd3-4e4b-f565-9e5bf68c563c","colab":{"base_uri":"https://localhost:8080/","height":34},"trusted":true},"cell_type":"code","source":"#Spherical Distance From City Centre For TRAIN\nentry = ['x_entry', 'y_entry']\n\nradius = 3963 #In miles\n\n#Store the entry and exisst coordinates in seperata vectors\nentry_vector = pd.Series(list(df_train[entry].values)).map(lambda x:np.array(x))\n\n#Make a list to store the distances\ndistances_vector = list()\n\nfor i in tqdm(range(len(entry_vector))):\n\n  #Entry and exit points\n  entry = tuple(entry_vector[i])\n  exit =  city_centre\n  \n  #Abs change in k\n  abs_change_in_k = np.abs(entry[1] - exit[1])\n  \n  \n  #change in sigma\n  triangle_sigma = np.arccos(np.sin(entry[0])*np.sin(exit[0]) + np.cos(entry[0])*np.cos(exit[0])*np.cos(abs_change_in_k))\n  \n  #Calculate spherical distance\n  distance = radius*triangle_sigma\n  distances_vector.append(distance)\n  \n#Add in a new column with this type of speed\ndf_train['SDistance_From_Centre'] = distances_vector\n","execution_count":null,"outputs":[]},{"metadata":{"id":"gq969wTS7gZw","colab_type":"code","outputId":"80e6d98d-9807-4555-e058-19692f7c09cc","colab":{"base_uri":"https://localhost:8080/","height":34},"trusted":true},"cell_type":"code","source":"#Spherical Distance From City Centre for TEST\nentry = ['x_entry', 'y_entry']\n\nradius = 3963 #In miles\n\n#Store the entry and exisst coordinates in seperata vectors\nentry_vector = pd.Series(list(df_test[entry].values)).map(lambda x:np.array(x))\n\n#Make a list to store the distances\ndistances_vector = list()\n\nfor i in tqdm(range(len(entry_vector))):\n\n  #Entry and exit points\n  entry = tuple(entry_vector[i])\n  exit =  city_centre\n  \n  #Abs change in k\n  abs_change_in_k = np.abs(entry[1] - exit[1])\n  \n  \n  #change in sigma\n  triangle_sigma = np.arccos(np.sin(entry[0])*np.sin(exit[0]) + np.cos(entry[0])*np.cos(exit[0])*np.cos(abs_change_in_k))\n  \n  #Calculate spherical distance\n  distance = radius*triangle_sigma\n  distances_vector.append(distance)\n  \n#Add in a new column with this type of speed\ndf_test['SDistance_From_Centre'] = distances_vector","execution_count":null,"outputs":[]},{"metadata":{"id":"sv2aOwkR7nc3","colab_type":"code","outputId":"ed733197-b29c-4b2f-e4f3-cbecaecc905e","colab":{"base_uri":"https://localhost:8080/","height":34},"trusted":true},"cell_type":"code","source":"#Euclidean Distance From City Centre for TRAIN\nentry = ['x_entry', 'y_entry']\n\n#Store the entry and exisst coordinates in seperata vectors\nentry_vector = pd.Series(list(df_train[entry].values)).map(lambda x:np.array(x))\n\n#Make a list to store the distances\ndistances_vector = list()\n\nfor i in tqdm(range(len(entry_vector))):\n\n  #Entry and exit points\n  entry = tuple(entry_vector[i])\n  exit =  city_centre\n  \n  distances_vector.append(euclidean(np.array(entry),np.array(exit)))\n  \n#Add in a new column with this type of speed\ndf_train['EDistance_From_Centre'] = distances_vector","execution_count":null,"outputs":[]},{"metadata":{"id":"5yZMV_zu8SCJ","colab_type":"code","outputId":"6178a341-341e-4669-8bba-1bad2b7ed587","colab":{"base_uri":"https://localhost:8080/","height":34},"trusted":true},"cell_type":"code","source":"#Euclidean Distance From City Centre for TEST\nentry = ['x_entry', 'y_entry']\n\n#Store the entry and exisst coordinates in seperata vectors\nentry_vector = pd.Series(list(df_test[entry].values)).map(lambda x:np.array(x))\n\n#Make a list to store the distances\ndistances_vector = list()\n\nfor i in tqdm(range(len(entry_vector))):\n\n  #Entry and exit points\n  entry = tuple(entry_vector[i])\n  exit =  city_centre\n  \n  distances_vector.append(euclidean(np.array(entry),np.array(exit)))\n  \n#Add in a new column with this type of speed\ndf_test['EDistance_From_Centre'] = distances_vector","execution_count":null,"outputs":[]},{"metadata":{"id":"iYzTyRHzXvRl","colab_type":"code","colab":{},"trusted":true},"cell_type":"code","source":"df_train['In_City_At_Entry'] = InCity(df_train['x_entry'],df_train['y_entry'])\ndf_test['In_City_At_Entry'] = InCity(df_test['x_entry'],df_test['y_entry'])","execution_count":null,"outputs":[]},{"metadata":{"id":"lsg_4di6SqeY","colab_type":"code","colab":{},"trusted":true},"cell_type":"code","source":"#Different parts of the city\nnorth_east_train = (df_train['x_entry'] > x_centre) & (df_train['y_entry'] > y_centre) & (df_train['In_City_At_Entry'] ==0)\nnorth_west_train = (df_train['x_entry'] < x_centre) & (df_train['y_entry'] > y_centre) & (df_train['In_City_At_Entry'] ==0)\nsouth_east_train = (df_train['x_entry'] > x_centre) & (df_train['y_entry'] < y_centre) & (df_train['In_City_At_Entry'] ==0)\nsouth_west_train = (df_train['x_entry'] < x_centre) & (df_train['y_entry'] < y_centre) & (df_train['In_City_At_Entry'] ==0)\n\n#Conditions\nconditions_train = [north_east_train,north_west_train,south_east_train,south_west_train]\n\n#Choice List\nchoices = ['North_East','North_West','South_East','South_West']\n\n#Part of the city\ndf_train['Area_of_City_Entry'] = np.select(conditions_train,choices,default = 'Already_In_City') ","execution_count":null,"outputs":[]},{"metadata":{"id":"WgjHQI1Lp0f2","colab_type":"code","colab":{},"trusted":true},"cell_type":"code","source":"#Different parts of the city\nnorth_east_test = (df_test['x_entry'] > x_centre) & (df_test['y_entry'] > y_centre) & (df_test['In_City_At_Entry'] ==0)\nnorth_west_test = (df_test['x_entry'] < x_centre) & (df_test['y_entry'] > y_centre) & (df_test['In_City_At_Entry'] ==0)\nsouth_east_test = (df_test['x_entry'] > x_centre) & (df_test['y_entry'] < y_centre) & (df_test['In_City_At_Entry'] ==0)\nsouth_west_test = (df_test['x_entry'] < x_centre) & (df_test['y_entry'] < y_centre) & (df_test['In_City_At_Entry'] ==0)\n\n#Conditions\nconditions_test = [north_east_test,north_west_test,south_east_test,south_west_test]\n\n#Choice List\nchoices = ['North_East','North_West','South_East','South_West']\n\n#Part of the city\ndf_test['Area_of_City_Entry'] = np.select(conditions_test,choices,default = 'Already_In_City') ","execution_count":null,"outputs":[]},{"metadata":{"id":"bozGgGj87iVy","colab_type":"text"},"cell_type":"markdown","source":"# Aggregating the data and making a new dataset for training"},{"metadata":{"id":"IOaYIvDpIpCF","colab_type":"code","colab":{},"trusted":true},"cell_type":"code","source":"#List of the current variables in the data\ncurrent_columns = list(df_train.columns)\n\n#List of new variables in our new datasert\npotential_columns = ['mean_x_entry', 'mean_y_entry', 'mean_x_exit', 'mean_y_exit', 'std_x_entry', 'std_y_entry', 'std_x_exit', 'std_y_exit', 'max_x_entry', 'max_y_entry', 'max_x_exit', 'max_y_exit', 'min_x_entry', 'min_y_entry', 'min_x_exit', 'min_y_exit', 'Mean_EDistance_From_Centre', 'Std_EDistance_From_Centre', 'Max_EDistance_From_Centre', 'Min_EDistance_From_Centre', 'IQR_EDistance_From_Centre', 'Mean_SDistance_From_Centre', 'Std_SDistance_From_Centre', 'Max_SDistance_From_Centre', 'Min_SDistance_From_Centre', 'IQR_SDistance_From_Centre', 'Prop_of_time_closer_to_city_E', 'Prop_of_time_closer_to_city_S', 'Favourite_Entry_Area', 'Sum_Time_Stayed', 'Mean_Time_Stayed', 'Std_Time_Stayed', 'Mean_Euclidean_Speed', 'Std_Euclidean_Speed', 'Max_Euclidean_Speed', 'Min_Euclidean_Speed', 'IQR_Euclidean_Speed', 'Mean_Spherical_Speed', 'Std_Spherical_Speed', 'Max_Spherical_Speed', 'Min_Spherical_Speed', 'IQR_Spherical_Speed', 'time_of_first_visit', '#_of_trajectories', 'Starting_Bearing', 'Last_Bearing', 'Proportion of times out of the city', 'Number_of_times_out_of_the_city', 'Mean_Euclidean_Distance', 'Median_Euclidean_Distance', 'Sum_Euclidean_Distance', 'Std_Euclidean_Distance', 'Max_Euclidean_Distance', 'Min_Euclidean_Distance', 'IQR_Euclidean_Distance', 'Mean_Spherical_Distance', 'Median_Spherical_Distance', 'Std_Spherical_Distance', 'Sum_Spherical_Distance', 'Max_Spherical_Distance', 'Min_Spherical_Distance', 'IQR_Spherical_Distance', 'Trajec_id', '#_of_Trajec_ids', 'Mean_VMin', 'Mean_VMax', 'Mean,VAve', 'Std_VMin', 'Std_VMax', 'Std_VAve', '#_of_VNans', 'Proportion_of_#_VNans']\n#Combinde the two lists\nnew_var_list=current_columns + potential_columns","execution_count":null,"outputs":[]},{"metadata":{"id":"xoAWkZs0zyNm","colab_type":"code","outputId":"7440fded-c360-4e76-e55c-ae7f8cb4f10a","colab":{"base_uri":"https://localhost:8080/","height":605},"trusted":true},"cell_type":"code","source":"#Make an empty data frame to new the dataset\ntraining_data = pd.DataFrame(index=range(len(df_train['hash'].unique())),columns = new_var_list)\n\n#Make a list of all the hashes\nhashes = list(df_train['hash'].unique())\n\n#Pick all the observations belonging to a hash\n\n#Create a dictionary to store results\nfeaature_dict = dict()\n\nfor i in tqdm(range(len(hashes))):\n\n\n    feaature_dict = dict()\n\n    #The hash value\n    j = hashes[i]\n\n    #Select all the observations except the last one\n    obs=df_train.loc[df_train['hash']==j]\n\n    #Get some agg statistics\n    first_obs = obs[:-1]\n\n\n\n    #Get the last observation\n    last_obs = obs.iloc[-1]\n    training_data.iloc[i,:] = last_obs\n\n    if len(first_obs) <2:\n        first_obs = obs\n\n    #Very Basic features\n    feaature_dict[\"mean_x_entry\"] = np.mean(first_obs['x_entry'])\n    feaature_dict[\"mean_y_entry\"] = np.mean(first_obs['y_entry'])\n    feaature_dict[\"mean_x_exit\"] = np.mean(first_obs['x_exit'])\n    feaature_dict[\"mean_y_exit\"] = np.mean(first_obs['y_exit'])\n    feaature_dict[\"std_x_entry\"] = np.std(first_obs['x_entry'])\n    feaature_dict[\"std_y_entry\"] = np.std(first_obs['y_entry'])\n    feaature_dict[\"std_x_exit\"] = np.std(first_obs['x_exit'])\n    feaature_dict[\"std_y_exit\"] = np.std(first_obs['y_exit'])\n    feaature_dict[\"max_x_entry\"] = np.max(first_obs['x_entry'])\n    feaature_dict[\"max_y_entry\"] = np.max(first_obs['y_entry'])\n    feaature_dict[\"max_x_exit\"] = np.max(first_obs['x_exit'])\n    feaature_dict[\"max_y_exit\"] = np.max(first_obs['y_exit'])\n    feaature_dict[\"min_x_entry\"] = np.min(first_obs['x_entry'])\n    feaature_dict[\"min_y_entry\"] = np.min(first_obs['y_entry'])\n    feaature_dict[\"min_x_exit\"] = np.min(first_obs['x_exit'])\n    feaature_dict[\"min_y_exit\"] = np.min(first_obs['y_exit'])\n      \n    feaature_dict['Mean_EDistance_From_Centre'] =  np.mean(first_obs['EDistance_From_Centre'])\n    feaature_dict['Std_EDistance_From_Centre'] =  np.std(first_obs['EDistance_From_Centre'])\n    feaature_dict['Max_EDistance_From_Centre'] =  np.max(first_obs['EDistance_From_Centre'])\n    feaature_dict['Min_EDistance_From_Centre'] =  np.min(first_obs['EDistance_From_Centre'])\n    feaature_dict['IQR_EDistance_From_Centre'] =  iqr(first_obs['EDistance_From_Centre'])\n    \n    feaature_dict['Mean_SDistance_From_Centre'] =  np.mean(first_obs['SDistance_From_Centre'])\n    feaature_dict['Std_SDistance_From_Centre'] =  np.std(first_obs['SDistance_From_Centre'])\n    feaature_dict['Max_SDistance_From_Centre'] =  np.max(first_obs['SDistance_From_Centre'])\n    feaature_dict['Min_SDistance_From_Centre'] =  np.min(first_obs['SDistance_From_Centre'])\n    feaature_dict['IQR_SDistance_From_Centre'] =  iqr(first_obs['SDistance_From_Centre'])\n    \n    #Proportion of times individual got closer to the city\n    feaature_dict['Prop_of_time_closer_to_city_E'] = 0\n    feaature_dict['Prop_of_time_closer_to_city_S'] = 0\n    \n    #Most popular area of entry\n    feaature_dict['Favourite_Entry_Area'] = first_obs['Area_of_City_Entry'].value_counts().index[0]\n\n    #Time stayed in seconds\n    feaature_dict[\"Sum_Time_Stayed\"] = np.sum(first_obs['Time_stayed_secs'])\n    feaature_dict[\"Mean_Time_Stayed\"] = np.mean(first_obs['Time_stayed_secs'])\n    feaature_dict[\"Std_Time_Stayed\"] = np.std(first_obs['Time_stayed_secs'])\n\n    #Euclidean Speed\n    feaature_dict['Mean_Euclidean_Speed'] = np.mean(first_obs['Euclidean_Speed'])\n    feaature_dict[\"Std_Euclidean_Speed\"] = np.std(first_obs['Euclidean_Speed'])\n    feaature_dict[\"Max_Euclidean_Speed\"] = np.max(first_obs['Euclidean_Speed'])\n    feaature_dict[\"Min_Euclidean_Speed\"] = np.min(first_obs['Euclidean_Speed'])\n    feaature_dict[\"IQR_Euclidean_Speed\"] = iqr(first_obs['Euclidean_Speed'])\n    \n    #Spherical Speed\n    feaature_dict['Mean_Spherical_Speed'] = np.mean(first_obs['Spherical_Speed'])\n    feaature_dict[\"Std_Spherical_Speed\"] = np.std(first_obs['Spherical_Speed'])\n    feaature_dict[\"Max_Spherical_Speed\"] = np.max(first_obs['Spherical_Speed'])\n    feaature_dict[\"Min_Spherical_Speed\"] = np.min(first_obs['Spherical_Speed'])\n    feaature_dict[\"IQR_Spherical_Speed\"] = iqr(first_obs['Spherical_Speed'])    \n    \n    #Slightly complicated\n    feaature_dict[\"time_of_first_visit\"] = first_obs['hour_of_day'].iloc[0]\n    feaature_dict[\"#_of_trajectories\"] = len(first_obs)\n    \n    #Bearing   \n    feaature_dict[\"Starting_Bearing\"] = first_obs['Bearings'].iloc[0]\n    feaature_dict[\"Last_Bearing\"] = first_obs['Bearings'].iloc[0]\n    \n    #Previous times in the city\n    feaature_dict[\"Proportion of times out of the city\"] = first_obs['In_City'].sum()/len(obs)\n    feaature_dict[\"Number_of_times_out_of_the_city\"] = first_obs['In_City'].sum()\n    \n    #Euclidean Distance\n    feaature_dict[\"Mean_Euclidean_Distance\"] = np.mean(first_obs['Euclidean_Distance'])\n    feaature_dict[\"Median_Euclidean_Distance\"] = np.median(first_obs['Euclidean_Distance'])\n    feaature_dict[\"Sum_Euclidean_Distance\"] = np.sum(first_obs['Euclidean_Distance'])\n    feaature_dict[\"Std_Euclidean_Distance\"] = np.std(first_obs['Euclidean_Distance'])\n    feaature_dict[\"Max_Euclidean_Distance\"] = np.max(first_obs['Euclidean_Distance'])\n    feaature_dict[\"Min_Euclidean_Distance\"] = np.min(first_obs['Euclidean_Distance'])\n    feaature_dict[\"IQR_Euclidean_Distance\"] = iqr(first_obs['Euclidean_Distance'])\n    \n    #Spherical Distance\n    feaature_dict[\"Mean_Spherical_Distance\"] = np.mean(first_obs['Spherical_Distance'])\n    feaature_dict[\"Median_Spherical_Distance\"] = np.median(first_obs['Spherical_Distance'])\n    feaature_dict[\"Std_Spherical_Distance\"] = np.std(first_obs['Spherical_Distance'])\n    feaature_dict[\"Sum_Spherical_Distance\"] = np.sum(first_obs['Spherical_Distance'])\n    feaature_dict[\"Max_Spherical_Distance\"] = np.max(first_obs['Spherical_Distance'])\n    feaature_dict[\"Min_Spherical_Distance\"] = np.min(first_obs['Spherical_Distance'])\n    feaature_dict[\"IQR_Spherical_Distance\"] = iqr(first_obs['Spherical_Distance'])    \n      \n    \n    #This depends on if there's more than one observation\n    if len(first_obs) >=2:\n      \n      #Bearing\n      feaature_dict[\"Starting_Bearing\"] = first_obs['Bearings'].iloc[0]\n      feaature_dict[\"Last_Bearing\"] = first_obs['Bearings'].iloc[-1]\n      \n      #Previous times in the city\n      feaature_dict[\"Proportion of times out of the city\"] = first_obs['In_City'].sum()/len(obs)\n      feaature_dict[\"Number_of_times_out_of_the_city\"] = first_obs['In_City'].sum()\n      \n      #Euclidean Distance\n      feaature_dict[\"Mean_Euclidean_Distance\"] = np.mean(first_obs['Euclidean_Distance'])\n      feaature_dict[\"Median_Euclidean_Distance\"] = np.median(first_obs['Euclidean_Distance'])\n      feaature_dict[\"Sum_Euclidean_Distance\"] = np.sum(first_obs['Euclidean_Distance'])\n      feaature_dict[\"Std_Euclidean_Distance\"] = np.std(first_obs['Euclidean_Distance'])\n      feaature_dict[\"Max_Euclidean_Distance\"] = np.max(first_obs['Euclidean_Distance'])\n      feaature_dict[\"Min_Euclidean_Distance\"] = np.min(first_obs['Euclidean_Distance'])\n      feaature_dict[\"IQR_Euclidean_Distance\"] = iqr(first_obs['Euclidean_Distance'])\n    \n      #Spherical Distance\n      feaature_dict[\"Mean_Spherical_Distance\"] = np.mean(first_obs['Spherical_Distance'])\n      feaature_dict[\"Median_Spherical_Distance\"] = np.median(first_obs['Spherical_Distance'])\n      feaature_dict[\"Std_Spherical_Distance\"] = np.std(first_obs['Spherical_Distance'])\n      feaature_dict[\"Sum_Spherical_Distance\"] = np.sum(first_obs['Spherical_Distance'])\n      feaature_dict[\"Max_Spherical_Distance\"] = np.max(first_obs['Spherical_Distance'])\n      feaature_dict[\"Min_Spherical_Distance\"] = np.min(first_obs['Spherical_Distance'])\n      feaature_dict[\"IQR_Spherical_Distance\"] = iqr(first_obs['Spherical_Distance'])  \n      \n      feaature_dict['Prop_of_time_closer_to_city_E'] = first_obs['EDistance_From_Centre'].diff()[1:].map(lambda x: 1 if x < 0 else 0).sum()/(len(first_obs) -1)\n      feaature_dict['Prop_of_time_closer_to_city_S'] = first_obs['SDistance_From_Centre'].diff()[1:].map(lambda x: 1 if x < 0 else 0).sum()/(len(first_obs) - 1)\n    \n\n      \n    #Trajectory id\n    feaature_dict[\"Trajec_id\"] = first_obs['New_Hash_Var_1'].iloc[0]\n    feaature_dict['#_of_Trajec_ids'] = len(first_obs)\n\n    #Vmax features\n    feaature_dict[\"Mean_VMin\"] = np.mean(first_obs['vmin'])\n    feaature_dict[\"Mean_VMax\"] = np.mean(first_obs['vmax'])\n    feaature_dict[\"Mean,VAve\"] = np.mean(first_obs['vmean'])\n    feaature_dict[\"Std_VMin\"] = np.std(first_obs['vmin'])\n    feaature_dict[\"Std_VMax\"] = np.std(first_obs['vmax'])\n    feaature_dict[\"Std_VAve\"] = np.std(first_obs['vmean'])\n    feaature_dict[\"#_of_VNans\"] = first_obs['vmean'].isna().sum()\n    feaature_dict['Proportion_of_#_VNans'] = first_obs['vmean'].isna().sum()/ len(first_obs)\n\n    training_data.loc[i,list(pd.concat([last_obs,pd.Series(feaature_dict)]).index)] = pd.concat([last_obs,pd.Series(feaature_dict)])\n","execution_count":null,"outputs":[]},{"metadata":{"id":"LwmxQLBc42qM","colab_type":"code","outputId":"1aae3926-c462-4695-9666-cc9fbf87876e","colab":{"base_uri":"https://localhost:8080/","height":605},"trusted":true},"cell_type":"code","source":"#Make an empty data frame to new the dataset\ntesting_data = pd.DataFrame(index=range(len(df_test['hash'].unique())),columns = new_var_list)\n\n#Make a list of all the hashes\nhashes = list(df_test['hash'].unique())\n\n#Pick all the observations belonging to a hash\n\n#Create a dictionary to store results\nfeaature_dict = dict()\n\nfor i in tqdm(range(len(hashes))):\n\n\n    feaature_dict = dict()\n\n    #The hash value\n    j = hashes[i]\n\n    #Select all the observations except the last one\n    obs=df_test.loc[df_test['hash']==j]\n\n    #Get some agg statistics\n    first_obs = obs[:-1]\n\n\n\n    #Get the last observation\n    last_obs = obs.iloc[-1]\n    testing_data.iloc[i,:] = last_obs\n\n    if len(first_obs) <2:\n        first_obs = obs\n\n    #Very Basic features\n    feaature_dict[\"mean_x_entry\"] = np.mean(first_obs['x_entry'])\n    feaature_dict[\"mean_y_entry\"] = np.mean(first_obs['y_entry'])\n    feaature_dict[\"mean_x_exit\"] = np.mean(first_obs['x_exit'])\n    feaature_dict[\"mean_y_exit\"] = np.mean(first_obs['y_exit'])\n    feaature_dict[\"std_x_entry\"] = np.std(first_obs['x_entry'])\n    feaature_dict[\"std_y_entry\"] = np.std(first_obs['y_entry'])\n    feaature_dict[\"std_x_exit\"] = np.std(first_obs['x_exit'])\n    feaature_dict[\"std_y_exit\"] = np.std(first_obs['y_exit'])\n    feaature_dict[\"max_x_entry\"] = np.max(first_obs['x_entry'])\n    feaature_dict[\"max_y_entry\"] = np.max(first_obs['y_entry'])\n    feaature_dict[\"max_x_exit\"] = np.max(first_obs['x_exit'])\n    feaature_dict[\"max_y_exit\"] = np.max(first_obs['y_exit'])\n    feaature_dict[\"min_x_entry\"] = np.min(first_obs['x_entry'])\n    feaature_dict[\"min_y_entry\"] = np.min(first_obs['y_entry'])\n    feaature_dict[\"min_x_exit\"] = np.min(first_obs['x_exit'])\n    feaature_dict[\"min_y_exit\"] = np.min(first_obs['y_exit'])\n      \n    feaature_dict['Mean_EDistance_From_Centre'] =  np.mean(first_obs['EDistance_From_Centre'])\n    feaature_dict['Std_EDistance_From_Centre'] =  np.std(first_obs['EDistance_From_Centre'])\n    feaature_dict['Max_EDistance_From_Centre'] =  np.max(first_obs['EDistance_From_Centre'])\n    feaature_dict['Min_EDistance_From_Centre'] =  np.min(first_obs['EDistance_From_Centre'])\n    feaature_dict['IQR_EDistance_From_Centre'] =  iqr(first_obs['EDistance_From_Centre'])\n    \n    feaature_dict['Mean_SDistance_From_Centre'] =  np.mean(first_obs['SDistance_From_Centre'])\n    feaature_dict['Std_SDistance_From_Centre'] =  np.std(first_obs['SDistance_From_Centre'])\n    feaature_dict['Max_SDistance_From_Centre'] =  np.max(first_obs['SDistance_From_Centre'])\n    feaature_dict['Min_SDistance_From_Centre'] =  np.min(first_obs['SDistance_From_Centre'])\n    feaature_dict['IQR_SDistance_From_Centre'] =  iqr(first_obs['SDistance_From_Centre'])\n    \n    #Proportion of times individual got closer to the city\n    feaature_dict['Prop_of_time_closer_to_city_E'] = 0\n    feaature_dict['Prop_of_time_closer_to_city_S'] = 0\n    \n    #Most popular area of entry\n    feaature_dict['Favourite_Entry_Area'] = first_obs['Area_of_City_Entry'].value_counts().index[0]\n\n    #Time stayed in seconds\n    feaature_dict[\"Sum_Time_Stayed\"] = np.sum(first_obs['Time_stayed_secs'])\n    feaature_dict[\"Mean_Time_Stayed\"] = np.mean(first_obs['Time_stayed_secs'])\n    feaature_dict[\"Std_Time_Stayed\"] = np.std(first_obs['Time_stayed_secs'])\n\n    #Euclidean Speed\n    feaature_dict['Mean_Euclidean_Speed'] = np.mean(first_obs['Euclidean_Speed'])\n    feaature_dict[\"Std_Euclidean_Speed\"] = np.std(first_obs['Euclidean_Speed'])\n    feaature_dict[\"Max_Euclidean_Speed\"] = np.max(first_obs['Euclidean_Speed'])\n    feaature_dict[\"Min_Euclidean_Speed\"] = np.min(first_obs['Euclidean_Speed'])\n    feaature_dict[\"IQR_Euclidean_Speed\"] = iqr(first_obs['Euclidean_Speed'])\n    \n    #Spherical Speed\n    feaature_dict['Mean_Spherical_Speed'] = np.mean(first_obs['Spherical_Speed'])\n    feaature_dict[\"Std_Spherical_Speed\"] = np.std(first_obs['Spherical_Speed'])\n    feaature_dict[\"Max_Spherical_Speed\"] = np.max(first_obs['Spherical_Speed'])\n    feaature_dict[\"Min_Spherical_Speed\"] = np.min(first_obs['Spherical_Speed'])\n    feaature_dict[\"IQR_Spherical_Speed\"] = iqr(first_obs['Spherical_Speed'])    \n    \n    #Slightly complicated\n    feaature_dict[\"time_of_first_visit\"] = first_obs['hour_of_day'].iloc[0]\n    feaature_dict[\"#_of_trajectories\"] = len(first_obs)\n    \n    #Bearing   \n    feaature_dict[\"Starting_Bearing\"] = first_obs['Bearings'].iloc[0]\n    feaature_dict[\"Last_Bearing\"] = first_obs['Bearings'].iloc[0]\n    \n    #Previous times in the city\n    feaature_dict[\"Proportion of times out of the city\"] = first_obs['In_City'].sum()/len(obs)\n    feaature_dict[\"Number_of_times_out_of_the_city\"] = first_obs['In_City'].sum()\n    \n    #Euclidean Distance\n    feaature_dict[\"Mean_Euclidean_Distance\"] = np.mean(first_obs['Euclidean_Distance'])\n    feaature_dict[\"Median_Euclidean_Distance\"] = np.median(first_obs['Euclidean_Distance'])\n    feaature_dict[\"Sum_Euclidean_Distance\"] = np.sum(first_obs['Euclidean_Distance'])\n    feaature_dict[\"Std_Euclidean_Distance\"] = np.std(first_obs['Euclidean_Distance'])\n    feaature_dict[\"Max_Euclidean_Distance\"] = np.max(first_obs['Euclidean_Distance'])\n    feaature_dict[\"Min_Euclidean_Distance\"] = np.min(first_obs['Euclidean_Distance'])\n    feaature_dict[\"IQR_Euclidean_Distance\"] = iqr(first_obs['Euclidean_Distance'])\n    \n    #Spherical Distance\n    feaature_dict[\"Mean_Spherical_Distance\"] = np.mean(first_obs['Spherical_Distance'])\n    feaature_dict[\"Median_Spherical_Distance\"] = np.median(first_obs['Spherical_Distance'])\n    feaature_dict[\"Std_Spherical_Distance\"] = np.std(first_obs['Spherical_Distance'])\n    feaature_dict[\"Sum_Spherical_Distance\"] = np.sum(first_obs['Spherical_Distance'])\n    feaature_dict[\"Max_Spherical_Distance\"] = np.max(first_obs['Spherical_Distance'])\n    feaature_dict[\"Min_Spherical_Distance\"] = np.min(first_obs['Spherical_Distance'])\n    feaature_dict[\"IQR_Spherical_Distance\"] = iqr(first_obs['Spherical_Distance'])    \n      \n    \n    #This depends on if there's more than one observation\n    if len(first_obs) >=2:\n      \n      #Bearing\n      feaature_dict[\"Starting_Bearing\"] = first_obs['Bearings'].iloc[0]\n      feaature_dict[\"Last_Bearing\"] = first_obs['Bearings'].iloc[-1]\n      \n      #Previous times in the city\n      feaature_dict[\"Proportion of times out of the city\"] = first_obs['In_City'].sum()/len(obs)\n      feaature_dict[\"Number_of_times_out_of_the_city\"] = first_obs['In_City'].sum()\n      \n      #Euclidean Distance\n      feaature_dict[\"Mean_Euclidean_Distance\"] = np.mean(first_obs['Euclidean_Distance'])\n      feaature_dict[\"Median_Euclidean_Distance\"] = np.median(first_obs['Euclidean_Distance'])\n      feaature_dict[\"Sum_Euclidean_Distance\"] = np.sum(first_obs['Euclidean_Distance'])\n      feaature_dict[\"Std_Euclidean_Distance\"] = np.std(first_obs['Euclidean_Distance'])\n      feaature_dict[\"Max_Euclidean_Distance\"] = np.max(first_obs['Euclidean_Distance'])\n      feaature_dict[\"Min_Euclidean_Distance\"] = np.min(first_obs['Euclidean_Distance'])\n      feaature_dict[\"IQR_Euclidean_Distance\"] = iqr(first_obs['Euclidean_Distance'])\n    \n      #Spherical Distance\n      feaature_dict[\"Mean_Spherical_Distance\"] = np.mean(first_obs['Spherical_Distance'])\n      feaature_dict[\"Median_Spherical_Distance\"] = np.median(first_obs['Spherical_Distance'])\n      feaature_dict[\"Std_Spherical_Distance\"] = np.std(first_obs['Spherical_Distance'])\n      feaature_dict[\"Sum_Spherical_Distance\"] = np.sum(first_obs['Spherical_Distance'])\n      feaature_dict[\"Max_Spherical_Distance\"] = np.max(first_obs['Spherical_Distance'])\n      feaature_dict[\"Min_Spherical_Distance\"] = np.min(first_obs['Spherical_Distance'])\n      feaature_dict[\"IQR_Spherical_Distance\"] = iqr(first_obs['Spherical_Distance'])  \n      \n      feaature_dict['Prop_of_time_closer_to_city_E'] = first_obs['EDistance_From_Centre'].diff()[1:].map(lambda x: 1 if x < 0 else 0).sum()/(len(first_obs) -1)\n      feaature_dict['Prop_of_time_closer_to_city_S'] = first_obs['SDistance_From_Centre'].diff()[1:].map(lambda x: 1 if x < 0 else 0).sum()/(len(first_obs) - 1)\n    \n\n      \n    #Trajectory id\n    feaature_dict[\"Trajec_id\"] = first_obs['New_Hash_Var_1'].iloc[0]\n    feaature_dict['#_of_Trajec_ids'] = len(first_obs)\n\n    #Vmax features\n    feaature_dict[\"Mean_VMin\"] = np.mean(first_obs['vmin'])\n    feaature_dict[\"Mean_VMax\"] = np.mean(first_obs['vmax'])\n    feaature_dict[\"Mean,VAve\"] = np.mean(first_obs['vmean'])\n    feaature_dict[\"Std_VMin\"] = np.std(first_obs['vmin'])\n    feaature_dict[\"Std_VMax\"] = np.std(first_obs['vmax'])\n    feaature_dict[\"Std_VAve\"] = np.std(first_obs['vmean'])\n    feaature_dict[\"#_of_VNans\"] = first_obs['vmean'].isna().sum()\n    feaature_dict['Proportion_of_#_VNans'] = first_obs['vmean'].isna().sum()/ len(first_obs)\n\n    testing_data.loc[i,list(pd.concat([last_obs,pd.Series(feaature_dict)]).index)] = pd.concat([last_obs,pd.Series(feaature_dict)])\n","execution_count":null,"outputs":[]},{"metadata":{"id":"C3zh9fjUG6w0","colab_type":"code","colab":{},"trusted":false},"cell_type":"code","source":"#Saving the data\ntraining_data.to_pickle(\"training_data.pkl\")\ntesting_data.to_pickle(\"testing_data.pkl\")","execution_count":0,"outputs":[]},{"metadata":{"id":"kAtdJKZ9SF_7","colab_type":"text"},"cell_type":"markdown","source":"> vmax, vmin and vmean have values reaching -1. That aint right"},{"metadata":{"id":"kzcqSgI9SkPI","colab_type":"text"},"cell_type":"markdown","source":"> vmax, vmin and vmean have values reaching -1"}],"metadata":{"colab":{"name":"Copy of Data Science Visualisation Challenge","version":"0.3.2","provenance":[],"collapsed_sections":["GXUQL28_3h0D","ki4s0U7sVSUN"]},"kernelspec":{"name":"python3","display_name":"Python 3"},"accelerator":"GPU"},"nbformat":4,"nbformat_minor":1}