Building a logistic regression model
In this exercise, you will build a logistic regression model using all features in the diabetes_df dataset. The model will be used to predict the probability of individuals in the test set having a diabetes diagnosis.
The diabetes_df dataset has been split into X_train, X_test, y_train, and y_test, and preloaded for you.
Questo esercizio fa parte del corso
Supervised Learning with scikit-learn
Istruzioni dell'esercizio
- Import
LogisticRegression. - Instantiate a logistic regression model,
logreg. - Fit the model to the training data.
- Predict the probabilities of each individual in the test set having a diabetes diagnosis, storing the array of positive probabilities as
y_pred_probs.
Esercizio pratico interattivo
Prova a risolvere questo esercizio completando il codice di esempio.
# Import LogisticRegression
____
# Instantiate the model
logreg = ____
# Fit the model
____
# Predict probabilities
y_pred_probs = logreg.____(____)[____, ____]
print(y_pred_probs[:10])