MulaiMulai sekarang secara gratis

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.

Latihan ini adalah bagian dari kursus

Supervised Learning with scikit-learn

Lihat Kursus

Petunjuk latihan

  • 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.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Import LogisticRegression
____

# Instantiate the model
logreg = ____

# Fit the model
____

# Predict probabilities
y_pred_probs = logreg.____(____)[____, ____]

print(y_pred_probs[:10])
Edit dan Jalankan Kode