Created
October 4, 2018 08:27
-
-
Save parmarsuraj99/398808608d5efd87a8f9900098ba6a91 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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