1#Logistic Regression Model
2
3from sklearn.linear_model import LogisticRegression
4LR = LogisticRegression(random_state=0).fit(X, y)
5LR.predict(X[:2, :]) #Return the predictions
6LR.score(X, y) #Return the mean accuracy on the given test data and labels
7
8#Regression Metrics
9#Mean Absolute Error
10
11from sklearn.metrics import mean_absolute_error
12mean_absolute_error(y_true, y_pred)
13
14#Mean Squared Error
15
16from sklearn.metrics import mean_squared_error
17mean_squared_error(y_true, p_pred)
18
19#R2 Score
20
21from sklearn.metrics import r2_score
22r2_score(y_true, y_pred)
1# import the class
2from sklearn.linear_model import LogisticRegression
3
4# instantiate the model (using the default parameters)
5logreg = LogisticRegression()
6
7# fit the model with data
8logreg.fit(X_train,y_train)
9
10#
11y_pred=logreg.predict(X_test)
12