Skip to content

Instantly share code, notes, and snippets.

@pierpaolo28
Created September 2, 2019 16:53
Show Gist options
  • Save pierpaolo28/ee565c5f08a1a660b53dbecf3af0f6d6 to your computer and use it in GitHub Desktop.
Save pierpaolo28/ee565c5f08a1a660b53dbecf3af0f6d6 to your computer and use it in GitHub Desktop.
df$blue <- as.numeric(df$blue)
df$dual_sim <- as.numeric(df$dual_sim)
df$four_g <- as.numeric(df$four_g)
df$price_range <- as.numeric(df$price_range)
## 75% of the sample size
smp_size <- floor(0.75 * nrow(df))
# set the seed to make our partition reproducible
set.seed(123)
train_ind <- sample(seq_len(nrow(df)), size = smp_size)
train <- df[train_ind, ]
test <- df[-train_ind, ]
x_train <- subset(train, select = -price_range)
y_train <- train$price_range
x_test <- subset(test, select = -price_range)
y_test <- test$price_range
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment