[scikit-learn] Tuning custom parameters using grid_search
Piotr Bialecki
piotr.bialecki at hotmail.de
Wed Sep 7 14:03:46 EDT 2016
Hi all,
I am currently tuning some parameters of my xgboost model using scikit's grid_search, e.g.:
param_test1 = {'max_depth':range(3,10,2),
'min_child_weight':range(1,6,2)
}
gsearch1 = GridSearchCV(estimator = XGBClassifier(learning_rate =0.1, n_estimators=762,
max_depth=5, min_child_weight=1, gamma=0,
subsample=0.8, colsample_bytree=0.8,
objective= 'binary:logistic', nthread=4,
scale_pos_weight=1, seed=2809),
param_grid = param_test1,
scoring='roc_auc',
n_jobs=6,
iid=False, cv=5)
Before that I preprocessed my dataset X with some different methods.
These preprocessing steps have some parameters too, which I would like to tune.
I know that it is possible to tune the parameters of the preprocessing steps,
if they are part pf my pipeline.
E.g. if I am using PCA, I could tune the parameter n_components, right?
But what if I have some "custom" preprocessing code with some parameters?
Is it possible to create a scikit-compatible "object" of my custom code in order to tune the
parameters in the pipeline with grid search?
Imagine I would like to write a custom method FeatureMultiplier() with a parameter multiplier_value.
Is it possible to create a scikit-compatible class out of this method and tune it with grid search?
I thought I saw a talk about exactly this topic at some PyData in 2016 or 2015,
but unfortunately I cannot find the video of it.
Maybe I misunderstood the presentation at that time.
Best regards,
Piotr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-learn/attachments/20160907/e51dc899/attachment.html>
More information about the scikit-learn
mailing list