nok / sklearn-porter

Transpile trained scikit-learn estimators to C, Java, JavaScript and others.
BSD 3-Clause "New" or "Revised" License
1.28k stars 170 forks source link

A bug #55

Closed Larry-Zheng closed 2 years ago

Larry-Zheng commented 5 years ago

Hey guys , there's a little bug —— "ValueError: ("The classifier doesn't support the given base estimator %s.", None)" . It seems that the default base estimator for adaboost is DecisionTree but the context code here is "if not isinstance(estimator.base_estimator, DecisionTreeClassifier):". So , please use clf.baseestimator (the variable ending with _ is automatically generated by code not given by user ).

nok commented 5 years ago

Hello @Larry-Zheng ,

thanks, you're right. This bug is already fixed in the next release (see https://github.com/nok/sklearn-porter/blob/feature/oop-api-refactoring/sklearn_porter/Estimator.py#L136-L145). In general did this bug prevent you to transform your estimator? If so I will push a little patch to the current stable version.

Best, Darius

Larry-Zheng commented 5 years ago

Hello @Larry-Zheng ,

thanks, you're right. This bug is already fixed in the next release (see https://github.com/nok/sklearn-porter/blob/feature/oop-api-refactoring/sklearn_porter/Estimator.py#L136-L145). In general did this bug prevent you to transform your estimator? If so I will push a little patch to the current stable version.

Best, Darius Well , if the base_estimator parameter is declared as DecisionTreeClassifier in Adaboost , the code works fine. And I'll try the latest release later, thanks ~