Skip to content

Instantly share code, notes, and snippets.

@parmarsuraj99
Created October 4, 2018 08:27
Show Gist options
  • Save parmarsuraj99/398808608d5efd87a8f9900098ba6a91 to your computer and use it in GitHub Desktop.
Save parmarsuraj99/398808608d5efd87a8f9900098ba6a91 to your computer and use it in GitHub Desktop.
#import libraries needed
import numpy as np
from sklearn import linear_model
if __name__=="__main__":
#load Dataset
#here i am creating one for Single variable Linear regression
x = np.array([[1, 2], [1, 4], [2, 3], [2, 2], [4.5, 7]])
y = np.array([0, 0, 1, 0, 1])
#Create an object for logistic regression
logistic = linear_model.LogisticRegression()
logistic.fit(x, y)
#predict for input
print(logistic.predict([[2, 3]]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment