Skip to content

Instantly share code, notes, and snippets.

@rodrigofp-cit
Created December 23, 2019 17:38
Show Gist options
  • Save rodrigofp-cit/782bb8ca498a3b8b2cbd650b97121abe to your computer and use it in GitHub Desktop.
Save rodrigofp-cit/782bb8ca498a3b8b2cbd650b97121abe to your computer and use it in GitHub Desktop.
black_friday_challenge_pipeline
from sklearn.ensemble import RandomForestRegressor
from train.models.custom_transformers import BlackFridayPreprocess, BlackFridayIdTransformer, BlackFridayLabelEncoder
from sklearn.pipeline import Pipeline
def random_forest():
pipeline = Pipeline(
[
('preprocess', BlackFridayPreprocess()),
('id_filter', BlackFridayIdTransformer(
min_freq={'Product_ID': 200, 'User_ID': 100})),
('label_encoder', BlackFridayLabelEncoder()),
('regressor', RandomForestRegressor(n_estimators=50, max_depth=15))
]
)
return pipeline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment