Created
July 3, 2017 09:28
-
-
Save mzaradzki/f7ce625c5adf1a16cc9df40770ae33a1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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) | |
LR.fit(dfLR_trn[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