My LinearRegression

From SeleznevAlex, 1 Year ago, written in Python, viewed 196 times.
URL http://codebin.org/view/2d71bdce Embed
Download Paste or View Raw
  1. class LinearRegression:
  2.     def fit(self, train_features, train_target):
  3.         self.w = np.zeros(train_features.shape)
  4.         self.w0 = pd.Series(data=[train_target.mean()]*train_target.shape[0])
  5.        
  6.        
  7.     def predict(self, test_features):
  8.         return test_features * self.w + self.w0

Reply to "My LinearRegression"

Here you can reply to the paste above