Skip to content

Commit 81ec2a4

Browse files
authored
Included a description of the α parameter in docstring of StatsBase.fit. (#50)
Additionally, added a check to enforce that α is greater than 0 and less than or equal to 1. α must be strictly greater than 0 because the computeλ function in Lasso.jl involves division by α.
1 parent af755b7 commit 81ec2a4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Lasso.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,9 @@ fit(LassoPath, X, y, Binomial(), Logit();
402402
value yielding a null model.
403403
If `λ` is unspecified, Lasso.jl selects `nλ` logarithmically spaced `λ` values from
404404
`λmax` to `λminratio * λmax`.
405+
- `α=1`: Value between 0 and 1 controlling the balance between ridge (``\alpha = 0``)
406+
and lasso (``\alpha = 1``) regression.
407+
α cannot be set to 0, though it may be set to 1.
405408
- `nλ=100` number of λ values to use
406409
- `λminratio=1e-4` if more observations than predictors otherwise 0.001.
407410
- `stopearly=true`: When `true`, if the proportion of deviance explained
@@ -472,6 +475,7 @@ function StatsBase.fit(::Type{LassoPath},
472475

473476
# Lasso initialization
474477
α = convert(T, α)
478+
0 < α <= 1 || error("α must satisfy 0 < α <= 1")
475479
λminratio = convert(T, λminratio)
476480
coefitr = randomize ? RandomCoefficientIterator() : (1:0)
477481

@@ -618,7 +622,7 @@ end
618622

619623
"predicted values for data used to estimate `path`"
620624
function StatsBase.predict(path::RegularizationPath; select=AllSeg())
621-
X = path.m.pp.X
625+
X = path.m.pp.X
622626
offset = path.m.rr.offset
623627

624628
# destandardize X if needed

0 commit comments

Comments
 (0)