sklearndf.regression.ElasticNetDF#
- class sklearndf.regression.ElasticNetDF(alpha=1.0, *, l1_ratio=0.5, fit_intercept=True, precompute=False, max_iter=1000, copy_X=True, tol=0.0001, warm_start=False, positive=False, random_state=None, selection='cyclic')[source]#
Linear regression with combined L1 and L2 priors as regularizer.
Note
This class is a wrapper around class
sklearn.linear_model.ElasticNet
. It provides enhanced support forpandas
data frames, and otherwise delegates all attribute access and method calls to an associatedElasticNet
instance.- Bases
- Metaclasses
Method summary
Make an unfitted clone of this estimator.
Fit this estimator using the given inputs.
Make a new wrapped DF estimator, delegating to a given native estimator that has already been fitted.
Get the parameters for this estimator.
Predict outputs for the given inputs.
Score this learner using the given inputs and outputs.
Set the parameters of this estimator.
Render this object as an expression.
Attribute summary
COL_FEATURE
Name assigned to an
Index
or aSeries
with the names of the features used to fit aEstimatorDF
.COL_PREDICTION
Name of
Series
objects containing the predictions of single-output learners.The pandas column index with the names of the features used to fit this estimator.
True
if this object is fitted,False
otherwise.The number of features used to fit this estimator.
The number of outputs used to fit this estimator.
The native estimator that this wrapper delegates to.
The name(s) of the output(s) this supervised learner was fitted to.
See documentation of
sklearn.linear_model.ElasticNet
.Definitions
- clone()#
Make an unfitted clone of this estimator.
- Return type
- Returns
the unfitted clone
- fit(X, y=None, **fit_params)#
Fit this estimator using the given inputs.
- Parameters
- Return type
- Returns
self
- classmethod from_fitted(estimator, features_in, n_outputs)#
Make a new wrapped DF estimator, delegating to a given native estimator that has already been fitted.
- Parameters
estimator (
ElasticNet
) – the fitted native estimator to use as the delegatefeatures_in (
Index
) – the column names of X used for fitting the estimatorn_outputs (
int
) – the number of outputs in y used for fitting the estimator
- Return type
- Returns
the wrapped data frame estimator
- get_params(deep=True)#
Get the parameters for this estimator.
- predict(X, **predict_params)#
Predict outputs for the given inputs.
The inputs must have the same features as the inputs used to fit this learner. The features can be provided in any order since they are identified by their column names.
- Parameters
- Return type
- Returns
predictions per observation as a series, or as a data frame in case of multiple outputs
- score(X, y, sample_weight=None)#
Score this learner using the given inputs and outputs.
- Parameters
X (
Union
[Series
,DataFrame
]) – data frame with observations as rows and features as columnsy (
Series
) – a series or data frame with the true outputs per observationsample_weight (
Optional
[Series
]) – optional series of scalar weights, for calculating the resulting score as the weighted mean of the scores for the individual predictions
- Return type
- Returns
the score
- set_params(**params)#
Set the parameters of this estimator.
Valid parameter keys can be obtained by calling
get_params()
.- Parameters
params (
Any
) – the estimator parameters to set- Return type
- Returns
self
- to_expression()#
Render this object as an expression.
- Return type
- Returns
the expression representing this object
- property feature_names_in_: pandas.Index#
The pandas column index with the names of the features used to fit this estimator.
- Raises
AttributeError – this estimator is not fitted
- Return type
- property n_features_in_: int#
The number of features used to fit this estimator.
- Raises
AttributeError – this estimator is not fitted
- Return type
- property n_outputs_: int#
The number of outputs used to fit this estimator.
- Raises
AttributeError – this estimator is not fitted
- Return type
- property native_estimator: sklearndf.wrapper.T_NativeEstimator#
The native estimator that this wrapper delegates to.
- Return type
TypeVar
(T_NativeEstimator
, bound=BaseEstimator
)
- property output_names_: List[str]#
The name(s) of the output(s) this supervised learner was fitted to.
- Raises
sklearn.exceptions.NotFittedError – this estimator is not fitted
- Return type
- property sparse_coef_#
See documentation of
sklearn.linear_model.ElasticNet
.