civisanalytics / python-glmnet

A python port of the glmnet package for fitting generalized linear models via penalized maximum likelihood.
Other
262 stars 59 forks source link

BUG Return correct prediction dims with and without lambda #53

Closed stephen-hoover closed 5 years ago

stephen-hoover commented 5 years ago

Instead of trying for a one-liner with magic squeeze behavior, only squeeze if predicting for a single lambda value, and then only squeeze off the last axis (the lambda path). This way we'll get the correct return shape for all input shapes, including single rows.

PR #51 fixed 1-row predictions for the case of single-lambda predictions with LogitNet, but didn't properly handle multi-lambda predictions, and didn't fix 1-row predictions for ElasticNet.

Closes #52 , #30 , #25 .