Home | Trees | Indices | Help |
---|
|
object --+ | properties.Function --+ | properties.CompositeFunction --+ | object --+ | | | properties.Gradient --+ | object --+ | | | properties.LipschitzContinuousGradient --+ | object --+ | | | properties.StepSize --+ | LinearRegression
The Linear regression loss function.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from Inherited from Inherited from Inherited from |
|
|||
__abstractmethods__ =
|
|||
Inherited from Inherited from |
|
|||
Inherited from |
|
Parameters ---------- X : Numpy array (n-by-p). The regressor matrix. y : Numpy array (n-by-1). The regressand vector. k : Non-negative float. The ridge parameter. mean : Boolean. Whether to compute the squared loss or the mean squared loss. Default is True, the mean squared loss.
|
Free any cached computations from previous use of this Function. From the interface "Function".
|
Function value. From the interface "Function". Parameters ---------- beta : Numpy array. Regression coefficient vector. The point at which to evaluate the function.
|
Gradient of the function at beta. From the interface "Gradient". Parameters ---------- beta : The point at which to evaluate the gradient. Examples -------- >>> import numpy as np >>> from parsimony.functions.losses import LinearRegression >>> >>> np.random.seed(42) >>> X = np.random.rand(100, 150) >>> y = np.random.rand(100, 1) >>> lr = LinearRegression(X=X, y=y) >>> beta = np.random.rand(150, 1) >>> round(np.linalg.norm(lr.grad(beta) ... - lr.approx_grad(beta, eps=1e-4)), 9) 1.3e-08
|
Lipschitz constant of the gradient. From the interface "LipschitzContinuousGradient". Examples -------- >>> import numpy as np >>> from parsimony.functions.losses import LinearRegression >>> >>> np.random.seed(42) >>> X = np.random.rand(10, 15) >>> y = np.random.rand(10, 1) >>> lr = LinearRegression(X=X, y=y) >>> L = lr.L() >>> L_ = lr.approx_L((15, 1), 10000) >>> L >= L_ True >>> round((L - L_) / L, 14) 0.14039091870818
|
The step size to use in descent methods. Parameters ---------- beta : Numpy array. The point at which to determine the step size.
|
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Mon Apr 6 23:52:11 2015 | http://epydoc.sourceforge.net |