| 4 | |
| 5 | |
| 6 | class Regularizer(object): |
| 7 | def __init__(self, C=0.01): |
| 8 | self.C = C |
| 9 | self._grad = elementwise_grad(self._penalty) |
| 10 | |
| 11 | def _penalty(self, weights): |
| 12 | raise NotImplementedError() |
| 13 | |
| 14 | def grad(self, weights): |
| 15 | return self._grad(weights) |
| 16 | |
| 17 | def __call__(self, weights): |
| 18 | return self.grad(weights) |
| 19 | |
| 20 | |
| 21 | class L1(Regularizer): |
nothing calls this directly
no outgoing calls
no test coverage detected