Created
July 3, 2017 09:35
-
-
Save mzaradzki/4f274dd96186dff3dfbb7cf82b147ddc 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.ensemble import RandomForestClassifier | |
dfRFC = dfOHE.sample(frac=1) # shuffle the dataset before spliting it in 2 parts | |
dfRFC_trn = dfRFC[0:45000] # training set | |
dfRFC_tst = dfRFC[45000:] # testing set | |
RFC = RandomForestClassifier(n_estimators=20, # number of trees in the "forest" ensemble | |
max_depth=25) # maximum depth of each tree | |
RFC.fit(dfRFC_trn[predictors].values, dfRFC_trn['status_group_enc'].values) | |
# model accuracy score between 0% and 100% | |
score = RFC.score(dfRFC_tst[predictors].values, dfRFC_tst['status_group_enc'].values) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment