Comments (2)
The packages may be generating a different path of regularization lambdas.
You can get them from the lasso path as l.λ
, and from GLMNet as g.lambda
.
Also, in your example it looks like you are picking the last coefs of the regularization path, but those are not necessarily the most interesting ones. Take a look at the docs here.
from lasso.jl.
Hi, thanks for chipping in.
I don't think the regularization lambdas is where the differences are coming from. In the maxnet algorithm the lambdas are generated inside the algorithm and not by the packages. Even if I force the lambdas to be identical, I see the same kind of behaviour.
The same goes for when I look at some other part of the regularization path (maxnet always takes the last one, but I see your point).
E.g. in this example I take coefficients halfway in the path and force the lambdas to be identical, and lasso_glmnet_dif(1000, 1000, 5)
is still around 0.02.
That seems like a big difference for it to come from floating point errors, which leads me to think the algorithms are somehow different?
function lasso_glmnet_dif(nrow, ncol, n_col_contributing)
data = rand(nrow, ncol)
outcome = mean(data[:, 1:n_col_contributing], dims = 1)[:,1] .> rand(nrow)
presence_matrix = [1 .- outcome outcome]
l = Lasso.fit(LassoPath, data, outcome, Binomial())
g = GLMNet.glmnet(data, presence_matrix, Binomial(); lambda = l.λ)
lcoefs = Vector(l.coefs[:,floor(Int,end/2)])
gcoefs = g.betas[:, floor(Int,end/2)]
mean(abs, lcoefs .- gcoefs)
end
from lasso.jl.
Related Issues (20)
- compats are outdated
- Intermittent Bounds Error HOT 3
- Accept weights that are not `AbstractVector{<:AbstractFloat}` HOT 3
- possible test failure in upcoming Julia version 1.5
- Fitting a LassoModel with a particular choice of lambda HOT 9
- Package fails when response is zero vector.
- Bug: BoundsError: attempt to access 200-element Array{Float64,1} at index [201] HOT 2
- TagBot trigger issue HOT 6
- Bug: Bounds error thrown for small regularization parameters
- please tag a new release for Pkg resolver HOT 5
- 0.6.3 precompilation error
- upgrades and documentation HOT 1
- preferred way of saving model HOT 1
- Document maximum iterations settings. HOT 1
- Declare error exception or throw warning instead of just using error()
- Model type LassoModel doesn't support intercept HOT 1
- StackOverflow with type Vector{Union{Float64, Missing}} even if no missing values present
- matrix is not square,how to fix it? HOT 2
- Improve documentation HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lasso.jl.