Skip to main content

Wraps sklearn linear_model regression functions to allow Drop1, Add1, and VIF calculations

Project description

SKLearn Linear Model Modification

This class should act exactly like sklearn linear model to solve regression problems with the benefit of being able to use drop1 and add1 based on AIC.

Installation

Run the following to install:

pip install sklearn_linear_model_modification

Usage

import pandas as pd
from sklearn_linear_model_modification.linear_model import LinearRegression, Add1LinearRegression, Drop1LinearRegression
from sklearn_linear_model_modification.linear_model import Lasso, Add1Lasso, Drop1Lasso
from sklearn_linear_model_modification.linear_model import ElasticNet, Add1ElasticNet, Drop1ElasticNet
from sklearn_linear_model_modification.linear_model import Ridge, Add1Ridge, Drop1Ridge

def load_Xy():
    data = load_boston()
    X = pd.DataFrame( data['data'], columns=data['feature_names'] )
    y = data['target']
    return X, y



X, y = load_Xy()

lmod = Ridge()
lmod.fit(X, y)

lmod = Lasso()
lmod.fit(X, y)

lmod = ElasticNet()
lmod.fit(X, y)

lmod = LinearRegression()
lmod.fit(X, y)


lmod = Add1Ridge()
lmod.fit(X, y)

lmod = Add1Lasso()
lmod.fit(X, y)

lmod = Add1ElasticNet()
lmod.fit(X, y)

lmod = Add1LinearRegression()
lmod.fit(X, y)

lmod = Drop1Ridge()
lmod.fit(X, y)

lmod = Drop1Lasso()
lmod.fit(X, y)

lmod = Drop1ElasticNet()
lmod.fit(X, y)

lmod = Drop1LinearRegression()
lmod.fit(X, y)

Development sklearn_linear_model_modification

To install sklearn_linear_model_modification, along with the tools you need to develop and run tests, run the following in your virtualend:

$ pip install -e .[dev]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

File details

Details for the file sklearn_linear_model_modification-0.0.1.tar.gz.

File metadata

  • Download URL: sklearn_linear_model_modification-0.0.1.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/3.10.0 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for sklearn_linear_model_modification-0.0.1.tar.gz
Algorithm Hash digest
SHA256 9e39c201511c93429b64663f46c5f80fb956a641f18e9856719eb8faf40e1e5c
MD5 1ff4ecd5b58fe63344b5a003f11111e1
BLAKE2b-256 2e5317a41141ae61cf72f2292838cd8860448d8191068f66cba6a2dce29523e8

See more details on using hashes here.

File details

Details for the file sklearn_linear_model_modification-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: sklearn_linear_model_modification-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/3.10.0 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for sklearn_linear_model_modification-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6d19aadf4eb87dec94a0fe514f143daf14b218d608f913d2e684ffec8aaad2eb
MD5 6f4527cd9e48895fb2617fcde1e4fb06
BLAKE2b-256 0f135ddf9b6add99a4e9ca2dbdf1103cb4a591abaed65d2b411570db49ca7f18

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page