Machine Learning Model: Logistic Regression

Amitabha Dey
Aug 14, 2018 · 5 min read
Image for post
Image for post
Image for post
Image for post
A demo dataset on GRE scores and corresponding Uni response
Image for post
Image for post
A linear best fit line in this situation would give bad predictions.
Image for post
Image for post
A sigmoid S-shaped curve
Image for post
Image for post
The formula for the sigmoid function. The function has a value between 0 and 1, which gives you the probability.
from sklearn.linear_model import LogisticRegression
classifier = LogisticRegression()
classifier.fit(X_train, y_train)
y_pred = classifier.predict(X_test)
Image for post
Image for post
An example of a confusion matrix. In the diagram, the number of incorrect predictions are 5 and 10, while the number of correct predictions are 50 and 100. Do you see how?
from sklearn.metrics import confusion_matrix
cm = confusion_matrix(y_test, y_pred)

“Visuals allows us to better understand insights and allow communicate these insights to other people. The data is often displayed in a story format that visualizes patterns, trends and correlations that may otherwise go unnoticed.”

Image for post
Image for post

Data Driven Investor

from confusion to clarity not insanity

By Data Driven Investor

In each issue we share the best stories from the Data-Driven Investor's expert community. Take a look

By signing up, you will create a Medium account if you don’t already have one. Review our Privacy Policy for more information about our privacy practices.

Check your inbox
Medium sent you an email at to complete your subscription.

Amitabha Dey

Written by

www.amitabhadey.com

Data Driven Investor

from confusion to clarity not insanity

Amitabha Dey

Written by

www.amitabhadey.com

Data Driven Investor

from confusion to clarity not insanity