Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
from sklearn.linear_model import LogisticRegression
dfLR = dfOHE.sample(frac=1) # shuffle the dataset before spliting it in 2 parts
dfLR_trn = dfLR[0:45000] # training set
dfLR_tst = dfLR[45000:] # testing set
LR = LogisticRegression(multi_class='ovr') # ovr = one (class) versus rest (of classes)[predictors].values, dfLR_trn['status_group_enc'].values)
# model accuracy score between 0% and 100%
score = LR.score(dfLR_tst[predictors].values, dfLR_tst['status_group_enc'].values)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment