I am trying to put my gbdt+lr pipeline into PMML pipeline. Followed instruction here, this is my test code:
gbm = lgb.LGBMClassifier(n_estimators=100)
clf = GBDTLRClassifier(gbm, LogisticRegression(penalty='l2'))
pipeline = PMMLPipeline([('classifier', clf)])
pipeline.fit(x, y, classifier__gbm_early_stopping_rounds=5, classifier__gbm_eval_set=[(xv, yv)], classifier__gbm_eval_metric='logloss', classifier__gbm_verbose = 2)
During fitting period, the verbose
parameter not working. Same setting works well in simple lightgbm classifier. Do anyone have idea about why verbose
not working?
Do anyone have idea about why verbose not working?
Does Scikit-Learn issue any warnings or errors? Such as that "'classifier' does not have 'gbm' attribute"?
You can take a look at GBDTLRClassifier
source code here.
The attribute that holds GBDT classifier is called GBDTLRClassifier.gbdt
(instead of GBDTLRClassifier.gbm
). Therefore, if you prefix your fit parameters with classifier__gbdt
(instead of classifier__gbm
), then everything should work fine:
pipeline = PMMLPipeline([('classifier', clf)])
pipeline.fit(x, y, classifier__gbdt__verbose = 2)