sdpython / mlinsights

Extends scikit-learn with new models, transformers, metrics, plotting.
http://www.xavierdupre.fr/app/mlinsights/helpsphinx/index.html
MIT License
69 stars 13 forks source link

Piecewise Estimator: binner not a decision tree #80

Closed Alex-Fay closed 3 years ago

Alex-Fay commented 4 years ago

Greetings,

TLDR: help sophomore undergrad figure out how to run piecewise estimator

I am trying to run the piecewise estimator and used a sample dataset from sklearn. When I try to run: obj = PiecewiseEstimator(binner= DecisionTreeClassifier, estimator=KMeans, n_jobs=None, verbose=False) PiecewiseEstimator.transform_bins(obj, diabetes_X)

I get the following error: binner is not a decision tree or a transform

I have the full code in google Colab here: https://colab.research.google.com/drive/1geF6s15QWKtkyg53cSWxBwX2Kjh_0JGD?usp=sharing

Ultimately, I am trying to figure out what steps I need to take to run the Piecewise Estimator. I figured I just needed to init an object of each class, but I am unsure if order matters.

sdpython commented 4 years ago

If you write PiecewiseEstimator(binner= DecisionTreeClassifier(), estimator=KMeans(), n_jobs=None, verbose=False), it should work. Without the bracket, binner= DecisionTreeClassifier, binner is a class not an instance.