Closed AsafManela closed 5 years ago
Changes Missing Coverage | Covered Lines | Changed/Added Lines | % | ||
---|---|---|---|---|---|
src/segselect.jl | 29 | 32 | 90.63% | ||
src/deprecated.jl | 0 | 21 | 0.0% | ||
<!-- | Total: | 34 | 58 | 58.62% | --> |
Files with Coverage Reduction | New Missed Lines | % | ||
---|---|---|---|---|
src/Lasso.jl | 5 | 62.91% | ||
<!-- | Total: | 5 | --> |
Totals | |
---|---|
Change from base Build 159: | 1.5% |
Covered Lines: | 541 |
Relevant Lines: | 612 |
Changes Missing Coverage | Covered Lines | Changed/Added Lines | % | ||
---|---|---|---|---|---|
src/segselect.jl | 29 | 32 | 90.63% | ||
src/deprecated.jl | 0 | 21 | 0.0% | ||
<!-- | Total: | 34 | 58 | 58.62% | --> |
Files with Coverage Reduction | New Missed Lines | % | ||
---|---|---|---|---|
src/Lasso.jl | 5 | 62.91% | ||
<!-- | Total: | 5 | --> |
Totals | |
---|---|
Change from base Build 159: | 1.5% |
Covered Lines: | 541 |
Relevant Lines: | 612 |
The current approach to selecting a regularization path segment is using the
select::Symbol
keyword argument as incoef(path; select=:AIC)
orpredict(path, newX; select=:AIC)
. Because one of the possibilities is to select coefficients from all segments withselect=:all
(the default), these methods are not type safe.This PR deprecates these methods, and replaces them with similar methods that take a path and a
SegSelect
struct, which takes care of the logic of selecting a particular segment. It implementsMinAIC
,MinAICc
,MinBIC
,MinCVmse
, andMinCV1se
segment selectors, and makes it easy to create new ones by defining a newSegSelect
struct and implementing itssegselect()
method.This PR also provides a simpler interface for fitting a lasso model and selecting the segment all in one call with a
fit(RegularizedModel, X, y, dist, link; <kwargs>)
method.It returns a
LinearModel
orGeneralizedLinearModel
representing the selected segment of a regularization path.For example,
This approach has the advantage that the model can be described (with
coef
) and used for prediction (withpredict
), without rerunning the selector, which can be expensive for cross-validating selectors.