Python Machine Learning
Logistic Regression
Logistic regression
Logistic Regression
Logistic regression aims to solve classification problems. It does this by predicting categorical outcomes, unlike linear regression that predicts a continuous outcome.
Logistic Regression Example
from sklearn import linear_model
import pandas as pd
df = pd.read_csv("data.csv")
X = df[['Age']]
y = df['Purchased']
logr = linear_model.LogisticRegression()
logr.fit(X, y)
predicted = logr.predict([[25]])
print(predicted)