Skip to content

Instantly share code, notes, and snippets.

@sam-thecoder
Created August 9, 2018 12:10
Show Gist options
  • Save sam-thecoder/1ba8b77b09858c1e46896400290514da to your computer and use it in GitHub Desktop.
Save sam-thecoder/1ba8b77b09858c1e46896400290514da to your computer and use it in GitHub Desktop.
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
y = df['Predict'].values
X = df[['Value USD', 'Drop 7', 'Up 7', 'Mean Change 7', 'Change']].values
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.20, random_state=42)
clf = RandomForestClassifier(max_depth=2, random_state=0)
clf.fit(X_train, y_train)
clf.score(X_test, y_test)
#0.8092783505154639
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment