Home | Trees | Indices | Help |
---|
|
object --+ | BaseEstimator --+ | RegressionEstimator --+ | LinearRegression
Linear regression: f(beta, X, y) = (1 / (2 * n)) * ||Xbeta - y||²_2, where ||.||²_2 is the squared L2-norm. Parameters ---------- algorithm : ExplicitAlgorithm. The algorithm that should be used. Should be one of: 1. GradientDescent(...) Default is GradientDescent(...). algorithm_params : A dict. The dictionary algorithm_params contains parameters that should be set in the algorithm. Passing algorithm=GradientDescent(**params) is equivalent to passing algorithm=GradientDescent() and algorithm_params=params. Default is an empty dictionary. start_vector : BaseStartVector. Generates the start vector that will be used. 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.gradient as gradient >>> >>> np.random.seed(42) >>> >>> n = 10 >>> p = 16 >>> X = np.random.rand(n, p) >>> y = np.random.rand(n, 1) >>> lr = estimators.LinearRegression(algorithm=gradient.GradientDescent(), ... algorithm_params=dict(max_iter=1000), ... mean=False) >>> error = lr.fit(X, y).score(X, y) >>> print "error = ", error error = 0.0116466703591
|
|||
|
|||
|
|||
|
|||
|
|||
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 |