Skip to content

Latest commit

 

History

History
43 lines (30 loc) · 1.12 KB

usage.md

File metadata and controls

43 lines (30 loc) · 1.12 KB

Usage

  1. Create a model
  2. Fit the model

SModel

The model type used by SparseRegression is SModel. An SModel holds onto the sufficient information for generating a solution fo the SparseRegression objective.

!!! note Constructing an SModel does not create a fitted model. It must be learn!-ed.

SModel

An SModel can be learned with the default learning strategy with learn!(model). You can provide more control over the learning process by providing your own LearningStrategy.

SparseRegression implements several Algorithm <: LearningStrategy types to do SModel fitting. An Algorithm must be constructed with an SModel to ensure storage buffers are the correct size.

using SparseRegression

# Make some fake data
x = randn(1000, 10)
y = x * range(-1, stop=1, length=10) + randn(1000)

# Create an SModel
s = SModel(x, y)

# All of the following are valid ways to calculate a solution
learn!(s)
learn!(s, strategy(ProxGrad(s), MaxIter(25), TimeLimit(.5)))
learn!(s, Sweep(s))
learn!(s, LinRegCholesky(s))