Skip to content

Instantly share code, notes, and snippets.

@drorhilman
Created November 17, 2017 10:13
Show Gist options
  • Save drorhilman/d690daf19d5da0e75f102648eb9245c7 to your computer and use it in GitHub Desktop.
Save drorhilman/d690daf19d5da0e75f102648eb9245c7 to your computer and use it in GitHub Desktop.
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import cross_val_score
forest = RandomForestClassifier(n_estimators=30, class_weight='balanced')
x = encoded[[c for c in encoded.columns if 'snp' in c]].values
y = classes.values
scores = cross_val_score(forest, x, y, cv=5)
scores.mean(), scores.std()
# (0.53006376086711415, 0.25595331741742744)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment