Menu
Coddy logo textTech

Logistic Regression

Lesson 15 of 19 in Coddy's Introduction to Machine Learning course.

Logistic regression, despite its name, is a linear model used primarily for classification tasks, not for regression. It's ideal for situations where you want to predict the presence or absence of something, such as whether or not an email is spam. Logistic regression works well for binary classification but can be extended to multiclass classification through different techniques.

Source: wikipedia

At its core, logistic regression predicts the probability that a given input point belongs to a certain class. Unlike linear regression which predicts a continuous output, logistic regression predicts a binary outcome (1/0, Yes/No). The crux of logistic regression lies in the logistic function or sigmoid function, which maps any real-valued number into a value between 0 and 1, making it suitable for probability estimation.

S(x)= \frac {1}{1+e^{-x}}

Fitting a logistic regression model involves finding the best set of coefficients for the equation given the training data.

While it's efficient and straightforward for binary classification, its performance might lag behind more complex models for intricate datasets.

quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

challenge icon

Challenge

Easy

Create a function named sigmoid that takes a list that represents a data point and returns the output of the sigmoid functions. Use numpy to solve this problem.

Try it yourself

import numpy as np
def sigmoid(point):
    arr = np.array(point)
    # Write code here

All lessons in Introduction to Machine Learning