You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running out of memory with LogisticRegression.predict on a dataset with,
n_samples = 1M, n_feature=8k, n_classes=800
This happens as LinearClassifierMixin.predict, needs to compute the decision function for all classes which involves a (n_samples, n_features) x (n_features, n_classes) multiplication, resulting in a (n_samples, n_classes) dense matrix (in my case ~6 GB).
Batching in n_samples is a solution, but it would have been nice to have a standard way of doing that, either as a util function that would be used to decorate e.g. batch_apply(LinearClassifierMixin.predict)(X) or a fit param LinearClassifierMixin.predict(X, batch_size=1000).
This is somewhat related to parallizing predict in general (since there batching also happens). Can't find the corresponding issue right now.
This particular case is made worse by the fact that LogisticRegression.coef_ is not enforced to be float32 for float32 sparse training input (with the liblinear solver) related #8769.
The text was updated successfully, but these errors were encountered:
The point of working_memory-based batching is that the user shouldn't care
about setting the batch size locally, and that we can reuse this
configuration wherever there are high temporary memory requirements that
can be estimated. I'd be happy to see it used here. A chunked_apply helper
sounds appropriate as long as it takes a param to estimate the temporary
memory cost per sample.
I'm running out of memory with LogisticRegression.predict on a dataset with,
This happens as
LinearClassifierMixin.predict
, needs to compute the decision function for all classes which involves a(n_samples, n_features) x (n_features, n_classes)
multiplication, resulting in a(n_samples, n_classes)
dense matrix (in my case ~6 GB).Batching in n_samples is a solution, but it would have been nice to have a standard way of doing that, either as a util function that would be used to decorate e.g.
batch_apply(LinearClassifierMixin.predict)(X)
or a fit paramLinearClassifierMixin.predict(X, batch_size=1000)
.This is somewhat related to parallizing predict in general (since there batching also happens). Can't find the corresponding issue right now.
This particular case is made worse by the fact that
LogisticRegression.coef_
is not enforced to be float32 for float32 sparse training input (with the liblinear solver) related #8769.The text was updated successfully, but these errors were encountered: