Home | Trees | Indices | Help |
---|
|
object --+ | BaseEstimator --+ | RegressionEstimator --+ | Lasso
Linear regression with an L1 penalty: f(beta, X, y) = (1 / (2 * n)) * ||Xbeta - y||²_2 + l * ||beta||_1, where ||.||_1 is the L1-norm. Parameters ---------- l : Non-negative float. The Lagrange multiplier, or regularisation constant, of the function. algorithm : ExplicitAlgorithm. The algorithm that should be applied. Should be one of: 1. FISTA(...) 2. ISTA(...) Default is FISTA(...). algorithm_params : A dict. The dictionary algorithm_params contains parameters that should be set in the algorithm. Passing algorithm=FISTA(**params) is equivalent to passing algorithm=FISTA() and algorithm_params=params. Default is an empty dictionary. start_vector : BaseStartVector. Generates the start vector that will be used. penalty_start : Non-negative integer. The number of columns, variables etc., to be exempt from penalisation. Equivalently, the first index to be penalised. Default is 0, all columns are included. mean : Boolean. Whether to compute the squared loss or the mean squared loss. Default is True, the mean squared loss. Examples -------- >>> import numpy as np >>> import parsimony.estimators as estimators >>> import parsimony.algorithms.proximal as proximal >>> n = 10 >>> p = 16 >>> >>> np.random.seed(42) >>> X = np.random.rand(n, p) >>> y = np.random.rand(n, 1) >>> l1 = 0.1 # L1 coefficient >>> lasso = estimators.Lasso(l1, ... algorithm=proximal.FISTA(), ... algorithm_params=dict(max_iter=1000), ... mean=False) >>> error = lasso.fit(X, y).score(X, y) >>> print "error = ", error error = 0.395494642796
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from Inherited from Inherited from |
|
|||
__abstractmethods__ =
|
|||
Inherited from Inherited from |
|
|||
Inherited from |
|
x.__init__(...) initializes x; see help(type(x)) for signature
|
Return a dictionary containing the estimator's parameters
|
Fit the estimator to the data.
|
Returns the (mean) squared error of the estimator.
|
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Mon Apr 6 23:52:10 2015 | http://epydoc.sourceforge.net |