seds-linear-regression-safdev758 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,3 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 safdev758
@@ -0,0 +1,24 @@
1
+ Metadata-Version: 2.4
2
+ Name: seds_linear_regression_safdev758
3
+ Version: 1.0.0
4
+ Summary: Simple Linear Regression from scratch
5
+ Home-page: https://github.com/safdev758/seds_simple_linear_regression
6
+ Author: safdev758
7
+ Author-email: safdev758@gmail.com
8
+ License: LICENSE.txt
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE.txt
11
+ Requires-Dist: numpy>=1.18.0
12
+ Dynamic: author
13
+ Dynamic: author-email
14
+ Dynamic: description
15
+ Dynamic: description-content-type
16
+ Dynamic: home-page
17
+ Dynamic: license
18
+ Dynamic: license-file
19
+ Dynamic: requires-dist
20
+ Dynamic: summary
21
+
22
+ # seds_simple_linear_regression
23
+
24
+ Simple Linear Regression package by safdev758.
@@ -0,0 +1,3 @@
1
+ # seds_simple_linear_regression
2
+
3
+ Simple Linear Regression package by safdev758.
@@ -0,0 +1,24 @@
1
+ Metadata-Version: 2.4
2
+ Name: seds_linear_regression_safdev758
3
+ Version: 1.0.0
4
+ Summary: Simple Linear Regression from scratch
5
+ Home-page: https://github.com/safdev758/seds_simple_linear_regression
6
+ Author: safdev758
7
+ Author-email: safdev758@gmail.com
8
+ License: LICENSE.txt
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE.txt
11
+ Requires-Dist: numpy>=1.18.0
12
+ Dynamic: author
13
+ Dynamic: author-email
14
+ Dynamic: description
15
+ Dynamic: description-content-type
16
+ Dynamic: home-page
17
+ Dynamic: license
18
+ Dynamic: license-file
19
+ Dynamic: requires-dist
20
+ Dynamic: summary
21
+
22
+ # seds_simple_linear_regression
23
+
24
+ Simple Linear Regression package by safdev758.
@@ -0,0 +1,10 @@
1
+ LICENSE.txt
2
+ README.md
3
+ setup.py
4
+ seds_linear_regression_safdev758.egg-info/PKG-INFO
5
+ seds_linear_regression_safdev758.egg-info/SOURCES.txt
6
+ seds_linear_regression_safdev758.egg-info/dependency_links.txt
7
+ seds_linear_regression_safdev758.egg-info/requires.txt
8
+ seds_linear_regression_safdev758.egg-info/top_level.txt
9
+ simple_linear_regression/__init__.py
10
+ simple_linear_regression/model.py
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,15 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name='seds_linear_regression_safdev758',
5
+ version='1.0.0',
6
+ author='safdev758',
7
+ author_email='safdev758@gmail.com',
8
+ url='https://github.com/safdev758/seds_simple_linear_regression',
9
+ packages=find_packages(),
10
+ license='LICENSE.txt',
11
+ description='Simple Linear Regression from scratch',
12
+ long_description=open('README.md').read(),
13
+ long_description_content_type='text/markdown',
14
+ install_requires=['numpy>=1.18.0'],
15
+ )
@@ -0,0 +1 @@
1
+ from .model import SimpleLinearRegression
@@ -0,0 +1,30 @@
1
+ import numpy as np
2
+
3
+ class SimpleLinearRegression:
4
+ def __init__(self):
5
+ self.b0 = None
6
+ self.b1 = None
7
+
8
+ def fit(self, X, y):
9
+ X = np.asarray(X, dtype=float).ravel()
10
+ y = np.asarray(y, dtype=float).ravel()
11
+ mean_x = np.mean(X)
12
+ mean_y = np.mean(y)
13
+ self.b1 = float(np.sum((X - mean_x) * (y - mean_y)) / np.sum((X - mean_x)**2))
14
+ self.b0 = float(mean_y - self.b1 * mean_x)
15
+ return self
16
+
17
+ def predict(self, X):
18
+ return self.b0 + self.b1 * np.asarray(X, dtype=float)
19
+
20
+ def score(self, X, y):
21
+ y = np.asarray(y, dtype=float).ravel()
22
+ y_pred = self.predict(X).ravel()
23
+ return float(1.0 - (np.sum((y - y_pred)**2) / np.sum((y - np.mean(y))**2)))
24
+
25
+ def rmse(self, X, y):
26
+ y = np.asarray(y, dtype=float).ravel()
27
+ return float(np.sqrt(np.mean((y - self.predict(X).ravel())**2)))
28
+
29
+ def __repr__(self):
30
+ return f"SimpleLinearRegression(b0={self.b0:.4f}, b1={self.b1:.4f})"