JuliaAI / MLJLinearModels.jl

Generalized Linear Regressions Models (penalized regressions, robust regressions, ...)
MIT License
81 stars 13 forks source link

fix penalize_intercept = false #111

Closed jbrea closed 2 years ago

jbrea commented 2 years ago

Before this PR

julia> using MLJ, MLJLinearModels, DataFrames
julia> x = rand(100); y = ones(100);
julia> mach = machine(RidgeRegressor(lambda = 10^3, penalize_intercept = false), DataFrame(x = x), y) |> fit!; fitted_params(mach)
[ Info: Training Machine{RidgeRegressor,…}.
(coefs = [:x => 0.0005237264329530076],
 intercept = 0.0009987266125463913,)

After this PR

julia> mach = machine(RidgeRegressor(lambda = 10^3, penalize_intercept = false), DataFrame(x = x), y) |> fit!; fitted_params(mach)
[ Info: Training Machine{RidgeRegressor,…}.
(coefs = [:x => 2.0416218416167516e-19],
 intercept = 0.9999999999999998,)
ablaom commented 2 years ago

On second thoughts, shouldn't we be adding a test that catches the original bug?

codecov-commenter commented 2 years ago

Codecov Report

Merging #111 (b81ae90) into dev (9f1987c) will not change coverage. The diff coverage is 100.00%.

:exclamation: Current head b81ae90 differs from pull request most recent head d4c7a7f. Consider uploading reports for the commit d4c7a7f to get more accurate results

Impacted file tree graph

@@           Coverage Diff           @@
##              dev     #111   +/-   ##
=======================================
  Coverage   96.04%   96.04%           
=======================================
  Files          21       21           
  Lines         860      860           
=======================================
  Hits          826      826           
  Misses         34       34           
Impacted Files Coverage Δ
src/fit/analytical.jl 100.00% <100.00%> (ø)
src/utils.jl 97.61% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 9f1987c...d4c7a7f. Read the comment docs.