Skip to content

Instantly share code, notes, and snippets.

@Mgancita
Created February 13, 2022 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mgancita/e93f73cd37cef4715e376bbd0dbce961 to your computer and use it in GitHub Desktop.
Save Mgancita/e93f73cd37cef4715e376bbd0dbce961 to your computer and use it in GitHub Desktop.
from sklearn.linear_model import LogisticRegression
log = LogisticRegression()
train_x = [[0, 0], [1, 1]]
train_y = [0, 1]
log.fit(train_x, train_y)
print(f"Coefficient: {log.coef_}")
# Coefficient: [[0.40105276 0.40105276]]
print(f"Y-Intercept: {log.intercept_}")
# Y-Intercept: [-0.40103584]
test_x = [[2, 2]]
print(f"Prediction: {log.predict(test_x)}")
# Prediction: [1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment