Challenge: Implementing Logistic Regression
Now let's implement the Logistic Regression in Python!
For this, the LogisticRegression
class is used.
Note that by default, Logistic Regression uses the ℓ2 regularization (penalty='l2'
). We will talk about regularization in later chapters. For now, we will stick to the default parameters.
The dataset for this chapter is about marketing campaigns based on phone calls from a Portuguese banking institution. The goal is to predict whether the user will subscribe to a term deposit.
The data is already preprocessed and ready to be fed to the model. Following chapters will cover the preprocessing needed for Logistic Regression.
Swipe to start coding
Build a Logistic Regression model and calculate the accuracy on the training set.
- Import
LogisticRegression
class. - Create an instance of class
LogisticRegression
with default parameters and train it. - Print the accuracy on the same
X, y
dataset.
Solución
¡Gracias por tus comentarios!
single
Pregunte a AI
Pregunte a AI
Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla
Awesome!
Completion rate improved to 3.57
Challenge: Implementing Logistic Regression
Desliza para mostrar el menú
Now let's implement the Logistic Regression in Python!
For this, the LogisticRegression
class is used.
Note that by default, Logistic Regression uses the ℓ2 regularization (penalty='l2'
). We will talk about regularization in later chapters. For now, we will stick to the default parameters.
The dataset for this chapter is about marketing campaigns based on phone calls from a Portuguese banking institution. The goal is to predict whether the user will subscribe to a term deposit.
The data is already preprocessed and ready to be fed to the model. Following chapters will cover the preprocessing needed for Logistic Regression.
Swipe to start coding
Build a Logistic Regression model and calculate the accuracy on the training set.
- Import
LogisticRegression
class. - Create an instance of class
LogisticRegression
with default parameters and train it. - Print the accuracy on the same
X, y
dataset.
Solución
¡Gracias por tus comentarios!
Awesome!
Completion rate improved to 3.57single