Last active
September 23, 2018 00:18
-
-
Save prratek/0a41376535f0909556dadf030b74f86c to your computer and use it in GitHub Desktop.
Code for Random Forest Medium blog post
This file contains 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
import pandas as pd | |
from sklearn.ensemble import RandomForestRegressor | |
n = 100 # use every 100th row | |
df = pd.read_csv('{PATH_TO_DATA}train.csv', skiprows=lambda i: i % n != 0) | |
m = RandomForestRegressor() # instantiate the RandomForestRegressor objects | |
m.fit(X_train, y_train) # train the model | |
m.score(X_valid, y_valid) # score it on your validation set |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment