Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Sandy4321/6497e71da3962b9d6007614bccc3f29a to your computer and use it in GitHub Desktop.
Save Sandy4321/6497e71da3962b9d6007614bccc3f29a 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