reggy

PyPI
Tests

Regressions with arbitrarily complex regularization terms.

Currently supported regularization terms:

  • LASSO

Installation

$ pip install reggy

Usage

A simple example with LASSO regularization:

import reggy
import numpy as np


alpha = 0.3
beta = 1.7

X = np.random.normal(size=(1000, 1))
y = np.random.normal(X * beta + alpha, size=(1000, 1))

model = reggy.RegReg(X, y, family=reggy.gaussian_family, regularizers=[reggy.lasso])
model.fit()

print(model.coef())
## (array([[0.27395004]], dtype=float32), array([[1.2682909]], dtype=float32))

GitHub

View Github