{"metadata":{"kernelspec":{"name":"ir","display_name":"R","language":"R"},"language_info":{"name":"R","codemirror_mode":"r","pygments_lexer":"r","mimetype":"text/x-r-source","file_extension":".r","version":"4.0.5"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"**Created by Burak Dilber**\n\n**Spaceship Titanic - tidyverse and tidymodels**\n\n**2 August 2022**","metadata":{}},{"cell_type":"markdown","source":"# <center> Spaceship Titanic - tidyverse and tidymodels</center>","metadata":{"execution":{"iopub.status.busy":"2022-08-02T13:59:58.702034Z","iopub.execute_input":"2022-08-02T13:59:58.704710Z","iopub.status.idle":"2022-08-02T13:59:58.848602Z"}}},{"cell_type":"markdown","source":"# Table of Contents\n<a id=\"toc\"></a>\n- [1. Introduction](#1)\n- [2. Imports](#2)\n- [3. Data Loading and Preperation](#3)\n    - [3.1 Exploring Train Data](#3.1)\n    - [3.2 Exploring Test Data](#3.2)\n    - [3.3 Submission File](#3.3)\n- [4. EDA](#4)\n    - [4.1 Continuous Features](#4.1)\n    - [4.2 Categorical Features](#4.2)\n    - [4.3 Target Variable](#4.3)\n- [5. Data Pre-Processing](#5)\n- [6. Validation](#6)\n- [7. Modeling](#7)\n    - [7.1 Hyperparameter Tuning](#7.1)\n    - [7.2 Final Hyperparameter and Last Fit](#7.2)\n    - [7.3 Test Data Prediction](#7.3)\n- [8. Submission](#8)","metadata":{}},{"cell_type":"markdown","source":"<a id=\"1\"></a>\n# **<center><span style=\"color:#00BFC4;\">Introduction  </span></center>**","metadata":{}},{"cell_type":"markdown","source":"The competition is organised by `Kaggle` and is in the `GettingStarted Prediction Competition` series.\n\nIn this competition, you are supposed to predict predict which passengers were transported by the anomaly using records recovered from the spaceship’s damaged computer system.\n\nSubmissions are evaluated on `Classification Accuracy`.","metadata":{}},{"cell_type":"markdown","source":"<a id=\"2\"></a>\n# **<center><span style=\"color:#00BFC4;\">Imports  </span></center>**","metadata":{}},{"cell_type":"code","source":"library(tidyverse) # for EDA\nlibrary(tidymodels) # for modelling","metadata":{"execution":{"iopub.status.busy":"2022-08-02T14:34:36.359328Z","iopub.execute_input":"2022-08-02T14:34:36.361127Z","iopub.status.idle":"2022-08-02T14:34:36.376202Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"3\"></a>\n# **<center><span style=\"color:#00BFC4;\">Data Loading and Preparation </span></center>**","metadata":{}},{"cell_type":"code","source":"spaceship_train <- read_csv(\"../input/spaceship-titanic/train.csv\") %>%\n  mutate(across(where(is.character) | where(is.logical), as.factor))\n\nspaceship_test <- read_csv(\"../input/spaceship-titanic/test.csv\") %>%\n  mutate(across(where(is.character) | where(is.logical), as.factor))\n\nsubmission <- read_csv(\"../input/spaceship-titanic/sample_submission.csv\")","metadata":{"execution":{"iopub.status.busy":"2022-08-02T14:34:36.391526Z","iopub.execute_input":"2022-08-02T14:34:36.393165Z","iopub.status.idle":"2022-08-02T14:34:36.758035Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## <span style=\"color:#e76f51;\"> Column Descriptions  : </span>\n\n\n- `PassengerId` - A unique Id for each passenger. Each Id takes the form gggg_pp where gggg indicates a group the passenger is travelling with and pp is their number within the group. People in a group are often family members, but not always.\n- `HomePlanet` - The planet the passenger departed from, typically their planet of permanent residence.\n- `CryoSleep` - Indicates whether the passenger elected to be put into suspended animation for the duration of the voyage. Passengers in cryosleep are confined to their cabins.\n- `Cabin` - The cabin number where the passenger is staying. Takes the form deck/num/side, where side can be either P for Port or S for Starboard.\n- `Destination` - The planet the passenger will be debarking to.\n- `Age` - The age of the passenger.\n- `VIP` - Whether the passenger has paid for special VIP service during the voyage.\n- `RoomService`, FoodCourt, ShoppingMall, Spa, VRDeck - Amount the passenger has billed at each of the Spaceship Titanic's many luxury amenities.\n- `Name` - The first and last names of the passenger.\n- `Transported` - Whether the passenger was transported to another dimension. This is the target, the column you are trying to predict.","metadata":{}},{"cell_type":"markdown","source":"<a id=\"3.1\"></a>\n## <span style=\"color:#e76f51;\"> Exploring Train Data : </span>","metadata":{}},{"cell_type":"markdown","source":"Below are the first 6 rows of train dataset:","metadata":{}},{"cell_type":"code","source":"spaceship_train %>% head()","metadata":{"execution":{"iopub.status.busy":"2022-08-02T14:34:36.761514Z","iopub.execute_input":"2022-08-02T14:34:36.763147Z","iopub.status.idle":"2022-08-02T14:34:36.802226Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Number of rows and columns:","metadata":{}},{"cell_type":"code","source":"dim(spaceship_train) # 8693 rows, 14 columns","metadata":{"execution":{"iopub.status.busy":"2022-08-02T14:34:36.805970Z","iopub.execute_input":"2022-08-02T14:34:36.807563Z","iopub.status.idle":"2022-08-02T14:34:36.822651Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Types of variables in the dataset:","metadata":{}},{"cell_type":"code","source":"glimpse(spaceship_train)","metadata":{"execution":{"iopub.status.busy":"2022-08-02T14:34:36.824934Z","iopub.execute_input":"2022-08-02T14:34:36.826279Z","iopub.status.idle":"2022-08-02T14:34:36.848443Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Since we define string values as factors while loading the data set, name and passenger id variables appear as factor type. However, these variables will not be included in the analysis anyway.","metadata":{}},{"cell_type":"markdown","source":"Total number of missing observations:","metadata":{}},{"cell_type":"code","source":"spaceship_train %>% \n  is.na() %>% \n  sum()","metadata":{"execution":{"iopub.status.busy":"2022-08-02T14:34:36.850963Z","iopub.execute_input":"2022-08-02T14:34:36.852425Z","iopub.status.idle":"2022-08-02T14:34:36.867896Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Column wise missing values:","metadata":{}},{"cell_type":"code","source":"spaceship_train %>%\n  select(everything()) %>%\n  summarise_all(funs(sum(is.na(.)))) %>%\n  t()","metadata":{"execution":{"iopub.status.busy":"2022-08-02T14:34:36.870295Z","iopub.execute_input":"2022-08-02T14:34:36.871673Z","iopub.status.idle":"2022-08-02T14:34:36.913906Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Descriptive Statistics of Train Data:","metadata":{}},{"cell_type":"code","source":"spaceship_train %>% summary()","metadata":{"execution":{"iopub.status.busy":"2022-08-02T14:34:36.916280Z","iopub.execute_input":"2022-08-02T14:34:36.917654Z","iopub.status.idle":"2022-08-02T14:34:36.943109Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"3.2\"></a>\n## <span style=\"color:#e76f51;\"> Exploring Test Data : </span>","metadata":{}},{"cell_type":"markdown","source":"Below are the first 6 rows of test dataset:","metadata":{}},{"cell_type":"code","source":"spaceship_test %>% head()","metadata":{"execution":{"iopub.status.busy":"2022-08-02T14:34:36.945518Z","iopub.execute_input":"2022-08-02T14:34:36.946898Z","iopub.status.idle":"2022-08-02T14:34:36.972034Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Number of rows and columns:","metadata":{}},{"cell_type":"code","source":"dim(spaceship_test) # 4277 rows, 13 columns","metadata":{"execution":{"iopub.status.busy":"2022-08-02T14:34:36.974539Z","iopub.execute_input":"2022-08-02T14:34:36.975934Z","iopub.status.idle":"2022-08-02T14:34:36.990766Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Types of variables in the dataset:","metadata":{}},{"cell_type":"code","source":"glimpse(spaceship_test)","metadata":{"execution":{"iopub.status.busy":"2022-08-02T14:35:25.238386Z","iopub.execute_input":"2022-08-02T14:35:25.239956Z","iopub.status.idle":"2022-08-02T14:35:25.264540Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Since we define string values as factors while loading the data set, name and passenger id variables appear as factor type. However, these variables will not be included in the analysis anyway.","metadata":{}},{"cell_type":"markdown","source":"Total number of missing observations:","metadata":{}},{"cell_type":"code","source":"spaceship_test %>% \n  is.na() %>% \n  sum()","metadata":{"execution":{"iopub.status.busy":"2022-08-02T14:36:10.025305Z","iopub.execute_input":"2022-08-02T14:36:10.027456Z","iopub.status.idle":"2022-08-02T14:36:10.048980Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Column wise missing values:","metadata":{}},{"cell_type":"code","source":"spaceship_test %>%\n  select(everything()) %>%\n  summarise_all(funs(sum(is.na(.)))) %>%\n  t()","metadata":{"execution":{"iopub.status.busy":"2022-08-02T14:36:37.851130Z","iopub.execute_input":"2022-08-02T14:36:37.853315Z","iopub.status.idle":"2022-08-02T14:36:37.909864Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Descriptive Statistics of Test Data:","metadata":{"execution":{"iopub.status.busy":"2022-08-02T14:37:40.453740Z","iopub.execute_input":"2022-08-02T14:37:40.455987Z","iopub.status.idle":"2022-08-02T14:37:40.474064Z"}}},{"cell_type":"code","source":"spaceship_test %>% summary()","metadata":{"execution":{"iopub.status.busy":"2022-08-02T14:38:31.120218Z","iopub.execute_input":"2022-08-02T14:38:31.122303Z","iopub.status.idle":"2022-08-02T14:38:31.146388Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"3.3\"></a>\n## <span style=\"color:#e76f51;\"> Submission File : </span>","metadata":{}},{"cell_type":"code","source":"submission %>% head()","metadata":{"execution":{"iopub.status.busy":"2022-08-02T14:39:34.472847Z","iopub.execute_input":"2022-08-02T14:39:34.475052Z","iopub.status.idle":"2022-08-02T14:39:34.503098Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"4\"></a>\n# **<center><span style=\"color:#00BFC4;\"> EDA </span></center>**","metadata":{}},{"cell_type":"markdown","source":"<a id=\"4.1\"></a>\n## <span style=\"color:#e76f51;\"> Continuos Features </span>","metadata":{}},{"cell_type":"markdown","source":"Continuous variables in the dataset are Age, RoomService, FoodCourt, ShoppingMall, Spa and VRDeck. The histograms of these variables are shown below.","metadata":{}},{"cell_type":"code","source":"\nspaceship_test <- mutate(spaceship_test, Transported = FALSE) %>%\n  mutate(across(where(is.logical), as.factor))\n\ntheme_set(theme_bw(12))\n\np <- rbind(spaceship_train %>% mutate(type = \"Train\"), spaceship_test %>% mutate(type = \"Test\")) %>%\n  filter_at(vars(HomePlanet, CryoSleep, Destination, VIP),all_vars(!is.na(.)))\n\np %>%\n  ggplot(aes(x = Age, fill = type)) +\n  geom_histogram(color=\"#e9ecef\", alpha = 0.6) +\n  labs(title = \"Histogram of Age\") +\n  xlab(\"Age\") +\n  ylab(\"Count\")\n\np %>%\n  ggplot(aes(x = RoomService, fill = type)) +\n  geom_histogram(color=\"#e9ecef\", alpha = 0.6) +\n  labs(title = \"Histogram of RoomService\") +\n  xlab(\"RoomService\") +\n  ylab(\"Count\")\n\np %>%\n  ggplot(aes(x = FoodCourt, fill = type)) +\n  geom_histogram(color=\"#e9ecef\", alpha = 0.6) +\n  labs(title = \"Histogram of FoodCourt\") +\n  xlab(\"FoodCourt\") +\n  ylab(\"Count\")\n\np %>%\n  ggplot(aes(x = ShoppingMall, fill = type)) +\n  geom_histogram(color=\"#e9ecef\", alpha = 0.6) +\n  labs(title = \"Histogram of ShoppingMall\") +\n  xlab(\"ShoppingMall\") +\n  ylab(\"Count\")\n\np %>%\n  ggplot(aes(x = Spa, fill = type)) +\n  geom_histogram(color=\"#e9ecef\", alpha = 0.6) +\n  labs(title = \"Histogram of Spa\") +\n  xlab(\"Spa\") +\n  ylab(\"Count\")\n\np %>%\n  ggplot(aes(x = VRDeck, fill = type)) +\n  geom_histogram(color=\"#e9ecef\", alpha = 0.6) +\n  labs(title = \"Histogram of VRDeck\") +\n  xlab(\"VRDeck\") +\n  ylab(\"Count\")","metadata":{"execution":{"iopub.status.busy":"2022-08-02T14:49:29.842735Z","iopub.execute_input":"2022-08-02T14:49:29.844469Z","iopub.status.idle":"2022-08-02T14:49:32.317257Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"4.2\"></a>\n## <span style=\"color:#e76f51;\"> Categorical Features </span>","metadata":{}},{"cell_type":"markdown","source":"Categorical variables in the dataset are HomePlanet, CryoSleep, Destination, VIP. The bar plot of these variables are shown below.","metadata":{}},{"cell_type":"code","source":"# Number of unique values for training data\nspaceship_train %>%\n  select(HomePlanet, CryoSleep, Destination, VIP) %>%\n  sapply(function(x) n_distinct(x, na.rm = TRUE))","metadata":{"execution":{"iopub.status.busy":"2022-08-02T14:54:48.816251Z","iopub.execute_input":"2022-08-02T14:54:48.818197Z","iopub.status.idle":"2022-08-02T14:54:48.846196Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Number of unique values for training data\nspaceship_test %>%\n  select(HomePlanet, CryoSleep, Destination, VIP) %>%\n  sapply(function(x) n_distinct(x, na.rm = TRUE))","metadata":{"execution":{"iopub.status.busy":"2022-08-02T14:54:50.938824Z","iopub.execute_input":"2022-08-02T14:54:50.940602Z","iopub.status.idle":"2022-08-02T14:54:50.967931Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"p %>%\n  ggplot(aes(x = HomePlanet, fill = type)) +\n  geom_bar(color=\"#e9ecef\", alpha = 0.6) +\n  labs(title = \"Bar Plot of HomePlanet\") +\n  xlab(\"HomePlanet\") +\n  ylab(\"Count\")\n\np %>%\n  ggplot(aes(x = CryoSleep, fill = type)) +\n  geom_bar(color=\"#e9ecef\", alpha = 0.6) +\n  labs(title = \"Bar Plot of CryoSleep\") +\n  xlab(\"CryoSleep\") +\n  ylab(\"Count\")\n\np %>%\n  ggplot(aes(x = Destination, fill = type)) +\n  geom_bar(color=\"#e9ecef\", alpha = 0.6) +\n  labs(title = \"Bar Plot of Destination\") +\n  xlab(\"Destination\") +\n  ylab(\"Count\")\n\np %>%\n  ggplot(aes(x = VIP, fill = type)) +\n  geom_bar(color=\"#e9ecef\", alpha = 0.6) +\n  labs(title = \"Bar Plot of VIP\") +\n  xlab(\"VIP\") +\n  ylab(\"Count\")","metadata":{"execution":{"iopub.status.busy":"2022-08-02T14:56:30.822922Z","iopub.execute_input":"2022-08-02T14:56:30.825040Z","iopub.status.idle":"2022-08-02T14:56:32.700715Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"4.3\"></a>\n## <span style=\"color:#e76f51;\"> Target Variable </span>","metadata":{}},{"cell_type":"code","source":"spaceship_train %>%\n  ggplot(aes(x = Transported)) +\n  geom_bar(color=\"#e9ecef\")","metadata":{"execution":{"iopub.status.busy":"2022-08-02T14:57:55.023517Z","iopub.execute_input":"2022-08-02T14:57:55.025424Z","iopub.status.idle":"2022-08-02T14:57:55.274253Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"5\"></a>\n# **<center><span style=\"color:#00BFC4;\">Data Pre-Processing  </span></center>**","metadata":{}},{"cell_type":"markdown","source":"Here PassengerId and Name variables are defined as id because they will not be included in the model. Knn imputation method was used for imputation of missing data. In addition, one hot encoding is applied to HomePlanet and Destination variables.","metadata":{}},{"cell_type":"code","source":"model_recipe <- \n  recipe(Transported ~ ., data = spaceship_train) %>% \n  update_role(PassengerId, Name, new_role = \"ID\") %>%\n  step_impute_knn(all_predictors()) %>%\n  step_dummy(HomePlanet, Destination, CryoSleep, VIP, one_hot = TRUE)\n\nprep(model_recipe)","metadata":{"execution":{"iopub.status.busy":"2022-08-02T15:04:02.128494Z","iopub.execute_input":"2022-08-02T15:04:02.131063Z","iopub.status.idle":"2022-08-02T15:04:05.905943Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"6\"></a>\n# **<center><span style=\"color:#00BFC4;\">Validation  </span></center>**","metadata":{}},{"cell_type":"markdown","source":"In order to reach the best hyperparameter values, validation technique was used.","metadata":{}},{"cell_type":"code","source":"set.seed(123)\nspaceship_val <- validation_split(spaceship_train, \n                               strata = Transported, \n                               prop = 0.80)","metadata":{"execution":{"iopub.status.busy":"2022-08-02T15:05:59.521138Z","iopub.execute_input":"2022-08-02T15:05:59.523525Z","iopub.status.idle":"2022-08-02T15:05:59.564965Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"7\"></a>\n# **<center><span style=\"color:#00BFC4;\">Modelling  </span></center>**","metadata":{}},{"cell_type":"markdown","source":"Random forest machine learning algorithm was used in this study. After the model was created, the preprocessing and modeling stages were combined with the workflow. The codes are below.","metadata":{}},{"cell_type":"code","source":"rf_model <- rand_forest(mtry = tune(), min_n = tune(), trees = 1000) %>% \n  set_engine(\"ranger\") %>% \n  set_mode(\"classification\")\n\nset.seed(123)\nrf_wf <-\n  workflow() %>%\n  add_model(rf_model) %>% \n  add_recipe(model_recipe)\nrf_wf","metadata":{"execution":{"iopub.status.busy":"2022-08-02T15:08:30.239885Z","iopub.execute_input":"2022-08-02T15:08:30.241716Z","iopub.status.idle":"2022-08-02T15:08:30.341553Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"7.1\"></a>\n## <span style=\"color:#e76f51;\"> Hyperparameter Tuning </span>","metadata":{}},{"cell_type":"markdown","source":"Grid search was performed for hyperparameter tuning.","metadata":{}},{"cell_type":"code","source":"rf_results <-\n  rf_wf %>% \n  tune_grid(resamples = spaceship_val,\n            grid = 25,\n            control = control_grid(save_pred = TRUE),\n            metrics = metric_set(accuracy)\n  )","metadata":{"execution":{"iopub.status.busy":"2022-08-02T15:09:44.297667Z","iopub.execute_input":"2022-08-02T15:09:44.299755Z","iopub.status.idle":"2022-08-02T16:02:25.340349Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Predictions and metrics:","metadata":{}},{"cell_type":"code","source":"rf_results %>% \n  collect_predictions()","metadata":{"execution":{"iopub.status.busy":"2022-08-02T16:03:06.519773Z","iopub.execute_input":"2022-08-02T16:03:06.521842Z","iopub.status.idle":"2022-08-02T16:03:08.917487Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"rf_results %>%\n  collect_metrics()","metadata":{"execution":{"iopub.status.busy":"2022-08-02T16:03:18.805522Z","iopub.execute_input":"2022-08-02T16:03:18.807443Z","iopub.status.idle":"2022-08-02T16:03:18.886761Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"The best hyperparameter values:","metadata":{}},{"cell_type":"code","source":"param_final <- rf_results %>%\n  select_best(metric = \"accuracy\")\nparam_final","metadata":{"execution":{"iopub.status.busy":"2022-08-02T16:03:34.597008Z","iopub.execute_input":"2022-08-02T16:03:34.598783Z","iopub.status.idle":"2022-08-02T16:03:34.679020Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"7.2\"></a>\n## <span style=\"color:#e76f51;\"> Final Hiperparameter and Last Fit </span>","metadata":{}},{"cell_type":"code","source":"last_rf_model <- rand_forest(mtry = param_final$mtry, min_n = param_final$min_n, trees = 1000) %>% \n  set_engine(\"ranger\") %>% \n  set_mode(\"classification\")\n\nlast_rf_wf <- rf_wf %>%\n  update_model(last_rf_model)\n\nlast_rf_fit <- \n  last_rf_wf %>% \n  fit(spaceship_train)","metadata":{"execution":{"iopub.status.busy":"2022-08-02T16:03:49.047274Z","iopub.execute_input":"2022-08-02T16:03:49.050135Z","iopub.status.idle":"2022-08-02T16:04:10.766670Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"7.3\"></a>\n## <span style=\"color:#e76f51;\"> Test Data Prediction </span>","metadata":{}},{"cell_type":"code","source":"test_pred <- predict(last_rf_fit, spaceship_test)\n\noptions(warn = getOption(\"warn\"))\ntest_pred_new <- test_pred %>% \n  mutate(.pred_class = str_to_title(.pred_class))\n\ntest_pred_new","metadata":{"execution":{"iopub.status.busy":"2022-08-02T16:04:18.343202Z","iopub.execute_input":"2022-08-02T16:04:18.344782Z","iopub.status.idle":"2022-08-02T16:04:38.838403Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"8\"></a>\n# **<center><span style=\"color:#00BFC4;\">Submission  </span></center>**","metadata":{}},{"cell_type":"code","source":"submission$Transported <- test_pred_new$.pred_class","metadata":{"execution":{"iopub.status.busy":"2022-08-02T16:04:38.842051Z","iopub.execute_input":"2022-08-02T16:04:38.844067Z","iopub.status.idle":"2022-08-02T16:04:38.883361Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"write_csv(submission, \"submission.csv\")","metadata":{"execution":{"iopub.status.busy":"2022-08-02T16:05:27.947042Z","iopub.execute_input":"2022-08-02T16:05:27.949539Z","iopub.status.idle":"2022-08-02T16:05:28.004225Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}