An easy-to-use Python regression library.
Project description
nemreg
A lightweight regression framework built on top of SciPy.
nemreg is designed to make regression analysis structured, compact, and easy to use — without sacrificing flexibility.
It wraps scipy.optimize.curve_fit in a clean scientific workflow that includes dataset handling, statistics, summaries, and plotting.
Install nemreg
install nemreg
Why nemreg?
SciPy is extremely powerful — but low-level.
With SciPy alone, you must manually:
- Prepare data shapes
- Compute residuals
- Compute R² / RMSE / χ²
- Handle uncertainties
- Write plotting code
- Structure outputs
nemreg provides this structure for you.
import nemreg as nr
ds = nr.Dataset(x, y, yerr=1.0)
res = nr.fit(ds, nr.models.linear())
nr.plot(mode="result_data", dataset=ds, result=res)
That’s it.
Features
- Clean
Datasetabstraction (1D and multivariable) - Weighted and unweighted regression
- Automatic statistics:
- R²
- RMSE
- χ²
- Reduced χ²
- Structured
FitResultobject - Built-in plotting dispatcher
- Built-in models (linear, polynomial, etc.)
- Support for replicated measurements
- Clean summary output
- Multivariable regression support
Installation
Clone the repository and install dependencies:
pip install numpy scipy matplotlib
Optional:
pip install pytest jupyter
Then install nemreg (editable mode recommended):
pip install -e .
Quick Start
import numpy as np
import nemreg as nr
x = np.linspace(-5, 5, 40)
y = 2.5*x - 1 + np.random.normal(0, 1, size=x.size)
ds = nr.Dataset(x=x, y=y)
res = nr.fit(ds, nr.models.linear())
nr.plot(mode="result_data", dataset=ds, result=res)
Project Philosophy
nemreg is not meant to replace SciPy.
It is meant to:
- Reduce boilerplate
- Encourage structured analysis
- Improve readability
- Make regression workflows easier to teach and share
SciPy remains the optimization engine under the hood.
Note from the Author
This library is intended for free use and free sharing, as it was created in the spirit of making regression easier for everyone.
Please refer to the LICENCE file for details on usage, modification, and redistribution.
The author strongly recommends browsing through the nemreg_demo.ipynb file.
It allows you to:
- Verify dependencies
- Confirm your environment works correctly
- See example workflows
- Explore available commands
Planned Features
- LaTeX export for automatic report generation
- Native Levenberg–Marquardt (LM) core implementation, trying to improve the regression capabilities on more complex functions
- Additional diagnostics (influence, leverage, etc.)
- Robust fitting / outlier handling
- Extended model library
- Improved multivariable visualization
License
See the LICENCE file for full details.
Contributing
Contributions, suggestions, and improvements are welcome.
Please open an issue or submit a pull request.
Acknowledgements
Built on top of:
- NumPy
- SciPy
- Matplotlib
These libraries power the numerical engine behind nemreg.
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 nemreg-0.1.0.tar.gz.
File metadata
- Download URL: nemreg-0.1.0.tar.gz
- Upload date:
- Size: 37.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a560f9d4da5d18147f3b5046e113865f6f19ed8d0a854250de63d3ec10aa466
|
|
| MD5 |
2ffd06b93724467e1466b1657fbab5e7
|
|
| BLAKE2b-256 |
ba9e2749d82ee12416556abeb870b4f7b9c9cb7f57ae36c6dbbcfe1dbfe09f1f
|
File details
Details for the file nemreg-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nemreg-0.1.0-py3-none-any.whl
- Upload date:
- Size: 51.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40347b07a02e6e49267aac592ed361b3e4433dab3cd1876132620ff039340b47
|
|
| MD5 |
1b8500349306249a269c36f8792543f4
|
|
| BLAKE2b-256 |
a3a73ef46bc615b75d210331ce4a80d5e49a8761cec3ccbba367a45dedf90335
|