One elastic net per variable, over every bin-by-channel column of the representation and, by default, their squares. There is no discrete selection step: the penalty path uses every column and shrinks, and the penalty itself is chosen by an inner cross-validation on the fitting units, so nothing about the model is decided outside the fold it is fitted in.
Usage
elasticnet(
data = NULL,
alpha = 0.5,
n_inner = 10L,
squares = TRUE,
s = "lambda.1se",
n_lambda = 100L,
tol = 1e-08,
threads = 1L,
seed = 1L
)Arguments
- data
A representation the learner is pinned to, or
NULLto run across every representation of the run.- alpha
Elastic-net mixing,
1lasso and0ridge.- n_inner
Folds of the inner cross-validation that chooses the penalty, ten as in
cv.glmnet().- squares
Add the square of every column, giving the same quadratic capacity a second-order polynomial term would.
- s
Which penalty of the inner path to predict at:
"lambda.min","lambda.1se", or a penalty of its own, which is interpolated between the two points of the path around it."lambda.1se", the largest penalty within one standard error of the least held-out deviance, is glmnet's default.- n_lambda
Points of the penalty path.
- tol
Where the coordinate descent stops, read off the largest coefficient move of a pass. The default leaves the fit as close to the optimum as glmnet's own default does; a looser one is faster and a tighter one costs time roughly in proportion.
- threads
How many responses are fitted at once, or, with one response to fit, how many fits of its inner cross-validation: the path on every fitting unit and the path of each inner fold are one independent fit each, so
n_inner + 1threads is as many as a lone response can use. The default is serial, because a package does not take a machine's cores without being asked. What comes back does not depend on it.- seed
Seed for the inner cross-validation's fold draw, which is random and would otherwise make the fit irreproducible.
Value
A learner().
Details
The family is the response head's: a binary cross-entropy loss fits a logistic model, a
squared-error loss a linear one and a Poisson-deviance loss a log-linear one, so the learner is
the same under a presence-absence head, a continuous one and a count one. So are the case
weights: the head's weights, positive_weights() for presence-absence, are what every learner
that ships fits under.
The inner folds are dealt for each response and stratified on it, so a rare outcome is spread
over them as evenly as its count allows. A presence-absence response whose inner training sets
cannot each hold two of each outcome, the fewest a logistic path is fitted to, has too few of
one outcome to choose a penalty on. It is predicted its share among the fitting units, as a
response holding one outcome is, and the fit names every such response in unfitted.
A reweighted fit that does not settle at a penalty ends its path there and keeps the points
before it, which is what glmnet does with the same event, and the penalty is chosen over the
points fitted. It happens where a rare outcome is nearly separable at the small end of the
path. The fit names every response whose path on the fitting units, or on any inner fold, ended
that way in stopped.
This is the aggregate-feature side of the comparison the package was built for, and it is the fair opponent for a network: a per-fold discrete selector pays selection variance a network never pays, so beating that one is not a matched result.
The path is fitted by the same core the Python package calls, so the two return the same coefficients for the same input. Its conventions are glmnet's, which is what the arm is measured against: weights normalised to sum to one, columns centred and scaled by their weighted mean and weighted standard deviation, a hundred penalties down from the smallest that leaves every coefficient at zero, and the held-out deviance read fold by fold.