Skip to content

Instantly share code, notes, and snippets.

@aniruddha27
Last active April 9, 2020 12:49
Show Gist options
  • Save aniruddha27/d89165cb685c26102b5883c75ebada5e to your computer and use it in GitHub Desktop.
Save aniruddha27/d89165cb685c26102b5883c75ebada5e to your computer and use it in GitHub Desktop.
# train models
from sklearn.linear_model import LogisticRegression
from sklearn.neighbors import KNeighborsClassifier
# logistic regression
model1 = LogisticRegression()
# knn
model2 = KNeighborsClassifier(n_neighbors=4)
# fit model
model1.fit(X_train, y_train)
model2.fit(X_train, y_train)
# predict probabilities
pred_prob1 = model1.predict_proba(X_test)
pred_prob2 = model2.predict_proba(X_test)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment