Last active
May 21, 2021 18:18
-
-
Save rajshah4/497ee3fb99ff27db22d35e70f39146a0 to your computer and use it in GitHub Desktop.
BostonModel
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 | |
import pickle | |
import datetime | |
## load data | |
df = pd.read_csv('/content/odsc-ml-drum/data/boston_housing.csv') | |
df.head() | |
## set features and target | |
X = df.drop('MEDV', axis=1) | |
y = df['MEDV'] | |
## train the model | |
rf = RandomForestRegressor(n_estimators = 20) | |
rf.fit(X,y) | |
## serialize the model | |
with open('/content/odsc-ml-drum/src/custom_model/rf.pkl', 'wb') as pkl: | |
pickle.dump(rf, pkl) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment