GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - timsetsfire/breeze-enets: GLMs and RLMs with elastic net regularization for Scala

BranchesTags
Open more actions menu

Latest commit

 

History

11 Commits
11 Commits

Folders and files

NameName
Last commit message
Last commit date
notebooks
notebooks
 
 
project
project
 
 
src/main/scala/glmnet
src/main/scala/glmnet
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
build.sbt
build.sbt
 
 

Repository files navigation

ENETS (Elastic Nets in Scala)

Simple framework for running generalized linear models or robust linear models with elastic net regularization in scala. Optimization is completed via coordinate descent as laid out in Regularization Paths for Generalized Linear Models via Coordinate Descent

Families

Via GlmNet class you can run the following generalized linear models with elastic net regularization:

  • Gaussian with identity link
  • Poisson with log link
  • Binomial with logit link
  • Negative Binomial with log link

Robust Norms

Via RlmNet class, you can run a robust linear model with elastic net regularization with one of the following robust norms.

Availabe robust norms include

  • Least Squares - default norm
  • Huber T
  • Ramsey E
  • Tukey Biweight
  • Cauchy
  • Trimmed Mean
  • Approximate Huber (smooth)
  • L1

The robust norms are based on the implementation in statsmodels for Python.

Requirements

Breeze.

SBT

Usage

import breeze.linalg.{DenseVector,DenseMatrix}
import breeze.stats.distributions.{Gaussian, Poisson,Binomial}
import com.github.timsetsfire.enets._
import com.github.timsetsfire.enets.robust.norms._
val x = DenseMatrix.rand(100,50,Gaussian(0,4))
val y = DenseVector.rand(100,Gaussian(0,4))
val g = DenseVector.rand(100,Binomial(1,0.3)).map{_.toDouble}
// logistic regression
val lr = new GlmNet(x,g,family="binomial",link="logit")
lr.fit
lr.plotCoordinatePath  // Don't use this when x.cols >>  It takes forever!
// linear regression
val linreg = new GlmNet(x,y) // or new RlmNet(x,y)
linreg.fit
// huber regression
val hr = new RlmNet(x,y,rnorm=HuberT())
hr.fit

If you want to be able to use this in jupyter-scala notebooks, change the scala version in build.sbt to 2.11.x and run

sbt package

Then from jupyter notebook

classpath.addPath("$PATH/enets/target/scala-2.11/enets_2.11-1.0.jar")

and

classpath.add("org.scalanlp" %% "breeze" % "0.13.2", "org.scalanlp" %% "breeze-natives" % "0.13.2", "org.scalanlp" %% "breeze-viz" % "0.13.2")

See the usage notebook in the notebooks folder.

About

GLMs and RLMs with elastic net regularization for Scala

Resources

Readme
MIT license
Activity

Stars

2 stars

Watchers

2 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.