Linear regression with gradient descent optimizer.
| 109 | |
| 110 | |
| 111 | class LinearRegression(BasicRegression): |
| 112 | """Linear regression with gradient descent optimizer.""" |
| 113 | |
| 114 | def _loss(self, w): |
| 115 | loss = self.cost_func(self.y, np.dot(self.X, w)) |
| 116 | return self._add_penalty(loss, w) |
| 117 | |
| 118 | def init_cost(self): |
| 119 | self.cost_func = mean_squared_error |
| 120 | |
| 121 | |
| 122 | class LogisticRegression(BasicRegression): |
no outgoing calls