A package for multiple linear regression by gradient descent.
Reason this release was yanked:
Incorrect README.md
Project description
This is the dev branch, where development usually happens
Multiple linear regression by gradient descent.Disclaimer:
This code is very early on and my first proper attempt to create a package so things may be a bit weird/not up to standard.Installation
To install mlr-gd you can use pip:
$ python -m pip install mlr-gd
Alternatively, you can install it by cloning the GitHub repository:
$ git clone https://github.com/DrSolidDevil/mlr-gd.git
$ cd mlr-gd
$ pip install .
To import the package into your script:
import melar
Example
import numpy as np
import melar
# y = x1 + 0.5*x2
x = np.array([[1, 3, 5, 8], [1, 2, 3, 6]])
y = np.array([1.5, 4, 6.5, 11])
learning_rate = 0.01
generations = 100
model = melar.LinearRegression(weights_amount=2)
model.train(x, y, learning_rate, generations, do_print=True)
print(f"Weights: {model.weights}, Bias: {model.bias}")
Gen: 0, Cost: 95.4852602406095
Gen: 1, Cost: 5.593624864417041
Gen: 2, Cost: 0.3286224504551768
Gen: 3, Cost: 0.020244781001893267
...
Gen: 99, Cost: 0.0007438760098695897
Training Complete
Weights: [0.94643617 0.57630021], Bias: -0.003265101149422934
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
mlr_gd-0.2.0.tar.gz
(9.4 kB
view details)
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 mlr_gd-0.2.0.tar.gz.
File metadata
- Download URL: mlr_gd-0.2.0.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f59a5dba8e5e9e0ac16434cafe4d37f0375e8a3c068c2c9900d8b971c0dc52d8
|
|
| MD5 |
2cef0e457084638bea781e6de0b1988b
|
|
| BLAKE2b-256 |
e8ccc1180700ece9e55d3aab34e6355a89ffdde896aa510cc91b16195563b492
|
File details
Details for the file mlr_gd-0.2.0-py3-none-any.whl.
File metadata
- Download URL: mlr_gd-0.2.0-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66c1a13e2ce0d3890e44134f344feaea17bbbf2e9dac3afec9a6c10dfa3c50f9
|
|
| MD5 |
ff558ddc33f291f3b09da230154d4904
|
|
| BLAKE2b-256 |
7b23572b0dfcebd66566cdf3d77ac12addb2fddeba443f4086594542e235ae69
|