question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[FEATURE] Run with given regressor instead of raising warning in ZeroInflatedRegressor

See original GitHub issue

I am using the ZeroInflatedRegressor for the prediction of some materials’ prices. For some materials I am getting this error:

Traceback (most recent call last):
  File "/home/bugra/project-mats/mat_analyser.py", line 61, in apply_regression
    zir.fit(X_train, y_train)
  File "/home/bugra/project-mats/mats_folder/lib/python3.7/site-packages/sklego/meta/zero_inflated_regressor.py", line 107, in fit
    "The predicted training labels are all zero, making the regressor obsolete. Change the classifier or use a plain regressor instead.")
ValueError: The predicted training labels are all zero, making the regressor obsolete. Change the classifier or use a plain regressor instead.

Tbh. I didn’t understand much from the error. But, I guess using the regressor (in my case this is LinearRegression from sklearn) could give me some results. Why ZeroInflatedRegressor can’t use the regressor I defined for it but instead raising this error? I think there should be a flag (a parameter) in ZeroInflatedRegressor which would let it fit the regressor as suggested by the error message if the user wants. If not, it could still raise this error.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
MBrounscommented, Aug 30, 2021

I’m thinking something along the lines of handle_unknown in sklearns OneHotEncoder

ZeroInflatedRegressor(handle_zero='error')
ZeroInflatedRegressor(handle_zero='ignore')
1reaction
DoDzilla-aicommented, Sep 1, 2021

@koaning I wish I could, currently struggling with health issues 😦

Read more comments on GitHub >

github_iconTop Results From Across the Web

Zero-Inflated Regression. Teach your regressor how to output…
When working on regression problems, often you have target values that are continuously and evenly distributed in some range.
Read more >
Zero-Inflated Negative Binomial Regression | R Data Analysis ...
Zero -inflated negative binomial regression is for modeling count variables with excessive zeros and it is usually for over-dispersed count outcome variables ...
Read more >
A guide to modeling outcomes that have lots of zeros with ...
In a previous post, I wrote a guide to doing beta, zero-inflated beta, and zero-one-inflated beta regression for outcome variables that are ...
Read more >
Zero-Inflated Generalized Linear Mixed Models: A Better Way ...
The coefficients of a Poisson regression are estimated by the likelihood function given by Expression (A4) as follows: L ...
Read more >
Approaches to regression with zero inflated response
In this case, where your data is simply overwhelmed by the number of zeros, IMO it makes the most sense to split this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found