Simple and flexible interface for basic linear regression
Project description
linreg
Simple and flexible interface for basic linear regression.
Motivation
I wanted to do very basic linear regression between two arrays of data.
It's a pain in the ass having to remember scikit-learn's interface for regression,
remember matplotlib's interface for plotting, and also having to do things like np.array(x).reshape(1,-1)
so that it works with sklearn
I wanted to create an interface that is as simple as possible and also relatively flexible with your input so that you don't have to open google every time you want to do some basic regression checking
Usage
linreg supports basic lists, numpy arrays, and pandas series
import linreg
x = [1,2,3]
y = [2,4,6]
linreg.linreg(x, y)
You can disable plotting with plot=False
If your data is a list of tuples, that works too
import linreg
xy = [
(1,2),
(2,4),
(3,6)
]
linreg.linreg(xy)
If your data is flipped, such that each column is a data point (instead of each row), then you can transpose it:
import linreg
xy = [
[1,2,3,4],
[2,4,6,8]
]
linreg.linreg(xy, transpose=True)
If you forget to transpose in the above case, linreg will log a warning.
It works by assuming that if you have more dimensions than data points, then you probably forgot to transpose.
You can suppress these warnings with warn=False
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file linreg-0.1.2.tar.gz.
File metadata
- Download URL: linreg-0.1.2.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8d90b4cfd9d34715575d0ca4aab0b4692c4f64bc59bc01645e8a60199a6b141
|
|
| MD5 |
1a280026207d72472241ae11bc9fb4ad
|
|
| BLAKE2b-256 |
c12813f524f9e68755724584dddaaf805798f17722705849e0f3c42a22a4998b
|
File details
Details for the file linreg-0.1.2-py3-none-any.whl.
File metadata
- Download URL: linreg-0.1.2-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
09ae956985da98f95fdcec7120f7454af4bc94c38a84f7cb503b625e47d113aa
|
|
| MD5 |
573880155ef4371ef32351586f698f09
|
|
| BLAKE2b-256 |
c563f8296cc60756e36b11ff9531b9bb8a751acb5bf6fbd4c5007cdcd1849d2a
|