February 2018
Beginner to intermediate
258 pages
5h 47m
English
Logistic regression might not be the fanciest algorithm in town, but for sure, it is one of the most commonly used. It is quite robust and powerful, yet simple to interpret. Unlike other methods, it is easy to look under the hood and see what it is doing.
First, we choose some indices for the training and testing set:
# Train, test, splitlibrary(caTools)set.seed(42)spl <- sample.split(X$sentiment, 0.7)train <- subset(X, spl == TRUE)test <- subset(X, spl == FALSE)
And now we split into train and test sets:
X_train <- subset(train,select=-sentiment)y_train <- train$sentimentX_test <- subset(test,select=-sentiment)y_test <- test$sentiment
Now let's look at the model and the coefficients:
model ...
Read now
Unlock full access