Skip to content

Conversation

@swayam9705
Copy link

Descript of Change

This PR refactors the existing functional linear regression implementation into a reusable LinearRegressionModel class. While the underlying mathematical logic remains the same, this structural change improves modularity and follows standard machine learning library conventions (like Scikit-Learn).

from linear_regression import LinearRegressionModel
points = pd.read_csv("<filename>")

xs = points['x'].values
ys  = points['y'].values

model = LinearRegressionModel()
model.points(xs, ys)
model.train(epochs=100, learning_rate=0.0000001)

model.predict(x)

Checklist

  • Refactored functional code into a class.
  • Verified that the mathematical output matches the original implementation.
  • Updated example usage/main block.
  • Added unit tests for the class methods (if applicable).

@swayam9705 swayam9705 changed the title Add class oriented linear regression model. Refactored functional linear regression code into a class Dec 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant