iiitl / Regression

This repository hosts a project centered around conducting regression analyses using our specific dataset.
MIT License
0 stars 14 forks source link

Simple Linear Regression #10 #45

Closed Dishant-garg closed 7 months ago

Dishant-garg commented 7 months ago

solved issue #10 i have get the better accuracy from my previous linear regression model done with libraries new r2_score: Screenshot (469) previous r2_score: Screenshot (434) @darshbaxi pls review the pr

darshbaxi commented 7 months ago

@Dishant-garg can you explain your approach!

Dishant-garg commented 7 months ago

Uses the normal equation to calculate coefficients: X.T.dot(X): Calculates the Gram matrix (X^T * X). np.linalg.inv(X.T.dot(X)): Inverts the Gram matrix. (X.T.dot(X)).dot(X.T).dot(y): Multiplies matrices to obtain coefficients. Uses matrix multiplication to predict target values: X.dot(np.hstack((self.intercept, self.coef))). It can work for small data sets but yaa it will give problem with large datasets due to matrix inversion

Dishant-garg commented 7 months ago

@darshbaxi pls tell if this is not asked by question