Skip to content

Instantly share code, notes, and snippets.

@glamp
Created May 22, 2019 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glamp/bace35ff7e5a0008abb34e6c190abc28 to your computer and use it in GitHub Desktop.
Save glamp/bace35ff7e5a0008abb34e6c190abc28 to your computer and use it in GitHub Desktop.
from sklearn.ensemble import RandomForestClassifier
clf = RandomForestClassifier()
target_variable = 'does-make-more-than-50k'
columns = ['age', 'education', 'hours-worked-per-week']
clf.fit(df[columns], df[target_variable])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment