<h1 align="center"> <br>
<img src="https://raw.githubusercontent.com/DrSolidDevil/mlr-gd/main/logo.png" width="300">
<br><br>
</h1>
<div id="badges" align="center">
<a href="https://github.com/DrSolidDevil/mlr-gd//releases/latest"><img alt="GitHub Release" src="https://img.shields.io/github/v/release/drsoliddevil/mlr-gd?label=latest%20release"></a>
<a href="https://pypi.org/project/mlr-gd/"><img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dm/mlr-gd?label=PyPi%20downloads"></a>
<img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/mlr-gd">
<img alt="GitHub repo size" src="https://img.shields.io/github/repo-size/DrSolidDevil/mlr-gd">
<a href="https://mlr-gd.readthedocs.io/"><img alt="Read the Docs" src="https://img.shields.io/readthedocs/mlr-gd"></a>
<a href="https://github.com/DrSolidDevil/mlr-gd/blob/main/LICENSE"><img alt="GitHub License" src="https://img.shields.io/github/license/drsoliddevil/mlr-gd"></a>
</div>
<br>
Multiple linear regression by gradient descent.
<br><br>
<h2>Installation</h2>
To install mlr-gd you can use [pip](https://pip.pypa.io):
```bash
$ python -m pip install mlr-gd
```
Alternatively, you can install it by cloning the [GitHub repository](https://github.com/DrSolidDevil/mlr-gd):
```bash
$ git clone https://github.com/DrSolidDevil/mlr-gd.git
$ cd mlr-gd
$ pip install .
```
<br>
To import the package into your script:
```python
import melar
```
<br>
<br>
<h2>Example</h2>
```python
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
```
Raw data
{
"_id": null,
"home_page": "https://github.com/DrSolidDevil/mlr-gd/",
"name": "mlr-gd",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "linear regression, linear, regression, gradient descent, machine learning, artificial intelligence",
"author": "DrSolidDevil",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/62/18/111a9df023ca8899ed18ae50f1719a2158d71625f7fb28f2f07b8b83ca42/mlr_gd-0.3.0.tar.gz",
"platform": null,
"description": "<h1 align=\"center\"> <br>\r\n <img src=\"https://raw.githubusercontent.com/DrSolidDevil/mlr-gd/main/logo.png\" width=\"300\">\r\n <br><br>\r\n</h1>\r\n\r\n<div id=\"badges\" align=\"center\">\r\n<a href=\"https://github.com/DrSolidDevil/mlr-gd//releases/latest\"><img alt=\"GitHub Release\" src=\"https://img.shields.io/github/v/release/drsoliddevil/mlr-gd?label=latest%20release\"></a>\r\n<a href=\"https://pypi.org/project/mlr-gd/\"><img alt=\"PyPI - Downloads\" src=\"https://img.shields.io/pypi/dm/mlr-gd?label=PyPi%20downloads\"></a>\r\n<img alt=\"PyPI - Python Version\" src=\"https://img.shields.io/pypi/pyversions/mlr-gd\">\r\n<img alt=\"GitHub repo size\" src=\"https://img.shields.io/github/repo-size/DrSolidDevil/mlr-gd\">\r\n<a href=\"https://mlr-gd.readthedocs.io/\"><img alt=\"Read the Docs\" src=\"https://img.shields.io/readthedocs/mlr-gd\"></a>\r\n<a href=\"https://github.com/DrSolidDevil/mlr-gd/blob/main/LICENSE\"><img alt=\"GitHub License\" src=\"https://img.shields.io/github/license/drsoliddevil/mlr-gd\"></a>\r\n</div>\r\n\r\n<br>\r\nMultiple linear regression by gradient descent.\r\n<br><br>\r\n<h2>Installation</h2>\r\n\r\nTo install mlr-gd you can use [pip](https://pip.pypa.io):\r\n\r\n```bash\r\n$ python -m pip install mlr-gd\r\n```\r\n\r\nAlternatively, you can install it by cloning the [GitHub repository](https://github.com/DrSolidDevil/mlr-gd):\r\n```bash\r\n$ git clone https://github.com/DrSolidDevil/mlr-gd.git\r\n$ cd mlr-gd\r\n$ pip install .\r\n```\r\n\r\n<br>\r\n\r\nTo import the package into your script: \r\n```python\r\nimport melar\r\n```\r\n\r\n<br>\r\n<br>\r\n<h2>Example</h2>\r\n\r\n\r\n```python\r\nimport numpy as np\r\nimport melar\r\n\r\n# y = x1 + 0.5*x2\r\nx = np.array([[1, 3, 5, 8], [1, 2, 3, 6]])\r\ny = np.array([1.5, 4, 6.5, 11])\r\n\r\nlearning_rate = 0.01\r\ngenerations = 100\r\n\r\n\r\nmodel = melar.LinearRegression(weights_amount=2)\r\nmodel.train(x, y, learning_rate, generations, do_print=True)\r\nprint(f\"Weights: {model.weights}, Bias: {model.bias}\")\r\n```\r\n\r\n\r\n```\r\nGen: 0, Cost: 95.4852602406095\r\nGen: 1, Cost: 5.593624864417041\r\nGen: 2, Cost: 0.3286224504551768\r\nGen: 3, Cost: 0.020244781001893267\r\n...\r\nGen: 99, Cost: 0.0007438760098695897\r\nTraining Complete\r\nWeights: [0.94643617 0.57630021], Bias: -0.003265101149422934\r\n```\r\n",
"bugtrack_url": null,
"license": "BSD 3-Clause",
"summary": "A package for multiple linear regression by gradient descent.",
"version": "0.3.0",
"project_urls": {
"Homepage": "https://github.com/DrSolidDevil/mlr-gd/"
},
"split_keywords": [
"linear regression",
" linear",
" regression",
" gradient descent",
" machine learning",
" artificial intelligence"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "9fc415b79fab642fb620c2c3f9c419c16b0313658514cf57b11cea89ffc91ace",
"md5": "05a60282445db20d8f67695e6e414ce1",
"sha256": "c9992fdc754dd5fae55876db09a2b5da5a47e823b32ef434c219bffd2c4dc76d"
},
"downloads": -1,
"filename": "mlr_gd-0.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "05a60282445db20d8f67695e6e414ce1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 6846,
"upload_time": "2025-02-15T18:32:50",
"upload_time_iso_8601": "2025-02-15T18:32:50.660393Z",
"url": "https://files.pythonhosted.org/packages/9f/c4/15b79fab642fb620c2c3f9c419c16b0313658514cf57b11cea89ffc91ace/mlr_gd-0.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "6218111a9df023ca8899ed18ae50f1719a2158d71625f7fb28f2f07b8b83ca42",
"md5": "4e89034e17a2c958009e842956d6f55f",
"sha256": "a125b1b2a722d723418cbae4fc2be8d8c11dca26ef8cd6b560006cf435610a43"
},
"downloads": -1,
"filename": "mlr_gd-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "4e89034e17a2c958009e842956d6f55f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 10208,
"upload_time": "2025-02-15T18:32:51",
"upload_time_iso_8601": "2025-02-15T18:32:51.806026Z",
"url": "https://files.pythonhosted.org/packages/62/18/111a9df023ca8899ed18ae50f1719a2158d71625f7fb28f2f07b8b83ca42/mlr_gd-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-15 18:32:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "DrSolidDevil",
"github_project": "mlr-gd",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "mlr-gd"
}