Making binary predictions with regression

Supervised Learning in R: Classification

Brett Lantz

Instructor

Introducing linear regression

Scatterplot

Scatterplot with Regression Line

Supervised Learning in R: Classification

Regression for binary classification

Binary Scatterplot

Binary Scatterplot with Regression Line

Supervised Learning in R: Classification

Introducing logistic regression

Binary Scatterplot with Logistic Curve

Binary Scatterplot with Logistic Curve

Supervised Learning in R: Classification

Making predictions with logistic regression

Binary Scatterplot with Logistic Curve

m <- glm(y ~ x1 + x2 + x3,
           data = my_dataset,
           family = "binomial")

Predictions with Logistic Curve

prob <- predict(m, test_dataset,
          type = "response")
pred <- ifelse(prob > 0.50, 1, 0)
Supervised Learning in R: Classification

Let's practice!

Supervised Learning in R: Classification

Preparing Video For Download...