Giter Club home page Giter Club logo

Comments (1)

JackDunnNZ avatar JackDunnNZ commented on June 11, 2024

It looks like the method that supports the string-vector input is this one:

function glmnet(X::AbstractMatrix, y; kw...)
lev = sort(unique(y))
if length(lev) >= 2
y = convert(Matrix{Float64}, [i == j for i in y, j in lev])
if length(lev) == 2
glmnet(X, y, Binomial(); kw...)
else
glmnet(X, y, Multinomial(); kw...)
end
else
error("y has only one level.")
end
end

So this works:

using GLMNet
y = ["M", "B", "M", "B"]
X = rand(4, 10)
glmnet(X, y)

The reason it doesn't need a distribution is because it chooses between Binomial and Multinomial based on the number of unique values in y. This method could probably be extended to support passing a distribution, and I guess throwing an error if the distribution and y are incompatible.

At the very least the README should be updated

from glmnet.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.