MCPcopy Create free account
hub / github.com/rushter/MLAlgorithms / Regularizer

Class Regularizer

mla/neuralnet/regularizers.py:6–18  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4
5
6class 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
21class L1(Regularizer):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected