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
MultiOutputRegressor doesn't support sparse y matrix #16686
Comments
I'm curious in what case you'd need a sparse y for regression. Could you describe your use case / application a bit more? But yes, we could implement densifying each y as we need to...? |
Basically I have a huge sparse Y matrix as well as the X (I'd been using numpy's multi-output lstsq but it does not work for sparse matrices and blows up in RAM). I think it is a common enough use-case (or at least in the docs). I wrote up a small Keras model to do a similar thing in mini-batches where I convert Converting each |
Okay. I would have thought least squares prediction wouldn't be a great
solution for a zero-inflated target.
In any case, I'd be happy to see MultiOutputRegressor handle such cases.
(It might also be interesting to make available a hierarchical
classifier-then-regressor for zero-inflated targets... Hmm...)
|
For context, the use case isn't for prediction, rather I'm interested in the coefficients that are estimated. At least for what I'm using it for, I want the beta/parameter that reflects the average effect for the cross sectional unit, including the zero units. The hierarchical model definitely makes sense for the prediction case though (something like a latent z that manifests as the observed |
This snippet works fine because the sparse
y
is converted to a numpy array.Same snippet without converting the sparse
y
matrix:This is the traceback:
My reading of the source is that the line here does not convert a sparse matrix into a numpy array. That is
does not return a numpy array of shape
(13, 2)
, instead it is a shape()
array containing the sparse matrix as its only element.The text was updated successfully, but these errors were encountered: