Type safe regularization path segment selection #29
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 with
select=: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 implements
MinAIC
,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 selectedsegment 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.