All our Data Science projects include bite-sized activities to test your knowledge and practice in an environment with constant feedback.
All our activities include solutions with explanations on how they work and why we chose them.
Store the features in X
and the target in y
. Both variables should be dataframes and keep the headers.
Despite there being various ways to solve this exercise, the results must be dataframes in order to be considered correct.
Set the random_state parameter to a desired integer value for reproducibility.
Store the values in the variables in
X_train
,X_test
,y_train
andy_test
.
Create an instance of the Logistic Regression
and store the model in lr
.
It's time to train the LogisticRegression using the training dataset.
Use the trained model to make predictions on the test data. Store the prediction in y_pred
.