linear-regression-package-yassamine 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) [year] [fullname]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,11 @@
1
+ Metadata-Version: 2.4
2
+ Name: linear-regression-package-yassamine
3
+ Version: 1.0.0
4
+ Summary: A simple linear regression package
5
+ Author: Student
6
+ License-File: LICENSE.txt
7
+ Requires-Dist: numpy
8
+ Dynamic: author
9
+ Dynamic: license-file
10
+ Dynamic: requires-dist
11
+ Dynamic: summary
@@ -0,0 +1,14 @@
1
+ # Linear Regression Package
2
+
3
+ A Python package that implements Simple Linear Regression
4
+ using Gradient Descent.
5
+
6
+ ## Installation
7
+
8
+ pip install linear-regression-package
9
+
10
+ ## Usage
11
+
12
+ from linear_regression import LinearRegression
13
+
14
+ model = LinearRegression()
@@ -0,0 +1 @@
1
+ from .model import LinearRegression
@@ -0,0 +1,34 @@
1
+ import numpy as np
2
+
3
+
4
+ class LinearRegression:
5
+ def __init__(self):
6
+ self.m = 0
7
+ self.b = 0
8
+
9
+ def fit(self, x, y, epochs=1000, lr=0.0001):
10
+ self.x = np.array(x, dtype=float)
11
+ self.y = np.array(y, dtype=float)
12
+
13
+ self.n = len(self.x)
14
+
15
+ if self.n != len(self.y):
16
+ raise ValueError("x and y must have the same length")
17
+
18
+ for i in range(epochs):
19
+ y_pred = self.m * self.x + self.b
20
+
21
+ D_m = (-2 / self.n) * np.sum(
22
+ self.x * (self.y - y_pred)
23
+ )
24
+
25
+ D_b = (-2 / self.n) * np.sum(
26
+ self.y - y_pred
27
+ )
28
+
29
+ self.m = self.m - lr * D_m
30
+ self.b = self.b - lr * D_b
31
+
32
+ def predict(self, x):
33
+ x = np.array(x, dtype=float)
34
+ return self.m * x + self.b
@@ -0,0 +1,11 @@
1
+ Metadata-Version: 2.4
2
+ Name: linear-regression-package-yassamine
3
+ Version: 1.0.0
4
+ Summary: A simple linear regression package
5
+ Author: Student
6
+ License-File: LICENSE.txt
7
+ Requires-Dist: numpy
8
+ Dynamic: author
9
+ Dynamic: license-file
10
+ Dynamic: requires-dist
11
+ Dynamic: summary
@@ -0,0 +1,10 @@
1
+ LICENSE.txt
2
+ README.md
3
+ setup.py
4
+ linear_regression/__init__.py
5
+ linear_regression/model.py
6
+ linear_regression_package_yassamine.egg-info/PKG-INFO
7
+ linear_regression_package_yassamine.egg-info/SOURCES.txt
8
+ linear_regression_package_yassamine.egg-info/dependency_links.txt
9
+ linear_regression_package_yassamine.egg-info/requires.txt
10
+ linear_regression_package_yassamine.egg-info/top_level.txt
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,10 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name='linear-regression-package-yassamine',
5
+ version='1.0.0',
6
+ author='Student',
7
+ packages=find_packages(),
8
+ description='A simple linear regression package',
9
+ install_requires=['numpy']
10
+ )