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

Method __init__

mla/linear_models.py:15–44  ·  view source on GitHub ↗

Basic class for implementing continuous regression estimators which are trained with gradient descent optimization on their particular loss function. Parameters ---------- lr : float, default 0.001 Learning rate. penalty : str, {'l1', 'l2'

(
        self, lr=0.001, penalty="None", C=0.01, tolerance=0.0001, max_iters=1000
    )

Source from the content-addressed store, hash-verified

13
14class BasicRegression(BaseEstimator):
15 def __init__(
16 self, lr=0.001, penalty="None", C=0.01, tolerance=0.0001, max_iters=1000
17 ):
18 """Basic class for implementing continuous regression estimators which
19 are trained with gradient descent optimization on their particular loss
20 function.
21
22 Parameters
23 ----------
24 lr : float, default 0.001
25 Learning rate.
26 penalty : str, {'l1', 'l2', None'}, default None
27 Regularization function name.
28 C : float, default 0.01
29 The regularization coefficient.
30 tolerance : float, default 0.0001
31 If the gradient descent updates are smaller than `tolerance`, then
32 stop optimization process.
33 max_iters : int, default 10000
34 The maximum number of iterations.
35 """
36 self.C = C
37 self.penalty = penalty
38 self.tolerance = tolerance
39 self.lr = lr
40 self.max_iters = max_iters
41 self.errors = []
42 self.theta = []
43 self.n_samples, self.n_features = None, None
44 self.cost_func = None
45
46 def _loss(self, w):
47 raise NotImplementedError()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected