MCPcopy Index your code
hub / github.com/rushter/MLAlgorithms / fit

Method fit

mla/linear_models.py:65–76  ·  view source on GitHub ↗
(self, X, y=None)

Source from the content-addressed store, hash-verified

63 return error
64
65 def fit(self, X, y=None):
66 self._setup_input(X, y)
67 self.init_cost()
68 self.n_samples, self.n_features = X.shape
69
70 # Initialize weights + bias term
71 self.theta = np.random.normal(size=(self.n_features + 1), scale=0.5)
72
73 # Add an intercept column
74 self.X = self._add_intercept(self.X)
75
76 self._train()
77
78 @staticmethod
79 def _add_intercept(X):

Callers

nothing calls this directly

Calls 4

init_costMethod · 0.95
_add_interceptMethod · 0.95
_trainMethod · 0.95
_setup_inputMethod · 0.80

Tested by

no test coverage detected