Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

logistic regression algorithm in python

# import the class
from sklearn.linear_model import LogisticRegression

# instantiate the model (using the default parameters)
logreg = LogisticRegression()

# fit the model with data
logreg.fit(X_train,y_train)

#
y_pred=logreg.predict(X_test)
Comment

logistic regression algorithm in python

print("Accuracy:",metrics.accuracy_score(y_test, y_pred))
print("Precision:",metrics.precision_score(y_test, y_pred))
print("Recall:",metrics.recall_score(y_test, y_pred))
Comment

logistic regression algorithm in python

# import the metrics class
from sklearn import metrics
cnf_matrix = metrics.confusion_matrix(y_test, y_pred)
cnf_matrix
Comment

importing logistic regression

sklearn.linear_model.LogisticRegression
Comment

logistic regression sklearn

LogisticRegression(penalty='l2',C=1.0, fit_intercept=True, max_iter=100)
Comment

PREVIOUS NEXT
Code Example
Python :: target encoder sklearn example 
Python :: embed python discord 
Python :: new paragraph python 
Python :: python tkinter treeview column width auto 
Python :: switch case python 3.10 
Python :: python find minimum date in list 
Python :: pandas rearrange rows based on datetime index 
Python :: pearsons correlation calculation 
Python :: python vector class 
Python :: slicing in python list 
Python :: how to print a value of a key in nested dictionary python 
Python :: python use variable name as string 
Python :: apply 2d mask to 3d array python 
Python :: best python books python 3 
Python :: dict comprehensions 
Python :: filter field set in django formds 
Python :: how to devided array into parts python 
Python :: lenet 5 keras 
Python :: enormous input test codechef solution 
Python :: foreach loop in python 
Python :: subplots 
Python :: file handling in python append byte 
Python :: adding numbers with numbers. python 
Python :: lower and upper case user input python 
Python :: python hash 
Python :: pivot index 
Python :: python capitalize 
Python :: implement stack using list in python 
Python :: qr detector 
Python :: panda lambda function returns dataframe 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =