Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sample weights for PiecewiseTreeRegressor #111

Open
jakebasilico opened this issue Aug 30, 2022 · 3 comments
Open

Sample weights for PiecewiseTreeRegressor #111

jakebasilico opened this issue Aug 30, 2022 · 3 comments

Comments

@jakebasilico
Copy link

jakebasilico commented Aug 30, 2022

I'm trying to build an ensemble learner using PiecewiseTreeRegressors. In doing so, the parameter "sample_weight" is utilized during fitting of the estimator. This throws an error here:

when executing line 136 in piecewise_tree_regression.py:

dec = LinearRegressorCriterion.create(xs, ys, ws)

AttributeError: 'mlinsights.mlmodel.piecewise_tree_regression_crite' object has no attribute 'sum'

@jakebasilico
Copy link
Author

Also an error here when checking whether sample_weight is none:

ws = sample_weight[ind].copy() if sample_weight else None

Because sample_weight is an numpy array, it looks like using sample_weight.any() or "if sample_weight is not None" fixes this issue

@jakebasilico
Copy link
Author

Loving the package so far!

@sdpython
Copy link
Owner

Sorry for the delay, is it possible to know how you call it? sample_weights should be an array.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants