Home | Trees | Indices | Help |
---|
|
object --+ | properties.Function --+ | object --+ | | | properties.Gradient --+ | object --+ | | | properties.StepSize --+ | object --+ | | | properties.LipschitzContinuousGradient --+ | LatentVariableVariance
|
|||
Inherited from |
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from Inherited from Inherited from Inherited from |
|
|||
__abstractmethods__ =
|
|||
Inherited from |
|
|||
Inherited from |
|
x.__init__(...) initializes x; see help(type(x)) for signature
|
Free any cached computations from previous use of this Function.
|
Function value. From the interface "Function". Examples -------- >>> import numpy as np >>> from parsimony.algorithms.nipals import FastSVD >>> from parsimony.functions.losses import LatentVariableVariance >>> >>> np.random.seed(1337) >>> X = np.random.rand(50, 150) >>> w = np.random.rand(150, 1) >>> var = LatentVariableVariance(X) >>> round(var.f(w), 12) -1295.854475188615 >>> round(-np.dot(w.T, np.dot(X.T, np.dot(X, w)))[0, 0] / 49.0, 12) -1295.854475188615
|
Gradient of the function. From the interface "Gradient". Parameters ---------- w : The point at which to evaluate the gradient. Examples -------- >>> import numpy as np >>> from parsimony.functions.losses import LatentVariableVariance >>> >>> np.random.seed(42) >>> X = np.random.rand(50, 150) >>> var = LatentVariableVariance(X) >>> w = np.random.rand(150, 1) >>> np.linalg.norm(var.grad(w) - var.approx_grad(w, eps=1e-4)) < 5e-8 True
|
Lipschitz constant of the gradient with given index. From the interface "LipschitzContinuousGradient". Examples -------- >>> import numpy as np >>> from parsimony.algorithms.nipals import FastSVD >>> from parsimony.functions.losses import LatentVariableVariance >>> >>> np.random.seed(1337) >>> X = np.random.rand(50, 150) >>> w = np.random.rand(150, 1) >>> var = LatentVariableVariance(X) >>> round(var.L(), 10) 47025.0809786841 >>> _, S, _ = np.linalg.svd(np.dot(X.T, X)) >>> round(np.max(S) * 49 / 2.0, 10) 47025.0809786841
|
The step size to use in descent methods. Parameters ---------- w : Numpy array. The point at which to determine the step size. Examples -------- >>> import numpy as np >>> from parsimony.algorithms.nipals import FastSVD >>> from parsimony.functions.losses import LatentVariableVariance >>> >>> np.random.seed(42) >>> X = np.random.rand(50, 150) >>> w = np.random.rand(150, 1) >>> var = LatentVariableVariance(X) >>> var.step(w) 2.1979627581251385e-05 >>> _, S, _ = np.linalg.svd(np.dot(X.T, X)) >>> round(1.0 / (np.max(S) * 49 / 2.0), 15) 2.1979627581e-05
|
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Mon Apr 6 23:52:11 2015 | http://epydoc.sourceforge.net |