Risk covariance estimators API¶
SampleCovariance¶
skportfolio.riskreturn._risk_estimators.
SampleCovariance
(
returns_data=False
, frequency=252
)
The standard sample covariance estimator, based on historical data.
fit_transform
(
X
,y
,**fit_params
)
(X_new : ndarray array of shape (n_samples, n_features_new)) — Fit to data, then transform it.get_params
(
deep
)
(params : dict) — Get parameters for this estimator.set_params
(
**params
)
(self : estimator instance) — Set the parameters of this estimator.
get_params
(
deep=True
)
Get parameters for this estimator.
deep
(bool, default=True) — If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
set_params
(
**params
)
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects
(such as :class:~sklearn.pipeline.Pipeline
). The latter have
parameters of the form <component>__<parameter>
so that it's
possible to update each component of a nested object.
**params
(dict) — Estimator parameters.
Estimator instance.
fit_transform
(
X
, y=None
, **fit_params
)
Fit to data, then transform it.
Fits transformer to X
and y
with optional parameters fit_params
and returns a transformed version of X
.
X
(array-like of shape (n_samples, n_features)) — Input samples.y
(array-like of shape (n_samples,) or (n_samples, n_outputs), default=None) — Target values (None for unsupervised transformations).**fit_params
(dict) — Additional fit parameters.
Transformed array.
CovarianceExp¶
skportfolio.riskreturn._risk_estimators.
CovarianceExp
(
returns_data=False
, frequency=252
, span=60
)
Estimator of covariance based on exponential weighted average of returns
fit_transform
(
X
,y
,**fit_params
)
(X_new : ndarray array of shape (n_samples, n_features_new)) — Fit to data, then transform it.get_params
(
deep
)
(params : dict) — Get parameters for this estimator.set_params
(
**params
)
(self : estimator instance) — Set the parameters of this estimator.
get_params
(
deep=True
)
Get parameters for this estimator.
deep
(bool, default=True) — If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
set_params
(
**params
)
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects
(such as :class:~sklearn.pipeline.Pipeline
). The latter have
parameters of the form <component>__<parameter>
so that it's
possible to update each component of a nested object.
**params
(dict) — Estimator parameters.
Estimator instance.
fit_transform
(
X
, y=None
, **fit_params
)
Fit to data, then transform it.
Fits transformer to X
and y
with optional parameters fit_params
and returns a transformed version of X
.
X
(array-like of shape (n_samples, n_features)) — Input samples.y
(array-like of shape (n_samples,) or (n_samples, n_outputs), default=None) — Target values (None for unsupervised transformations).**fit_params
(dict) — Additional fit parameters.
Transformed array.
CovarianceGlasso¶
skportfolio.riskreturn._risk_estimators.
CovarianceGlasso
(
returns_data=False
, frequency=252
)
Estimator of covariance based on GLASSO algorithm
fit_transform
(
X
,y
,**fit_params
)
(X_new : ndarray array of shape (n_samples, n_features_new)) — Fit to data, then transform it.get_params
(
deep
)
(params : dict) — Get parameters for this estimator.set_params
(
**params
)
(self : estimator instance) — Set the parameters of this estimator.
get_params
(
deep=True
)
Get parameters for this estimator.
deep
(bool, default=True) — If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
set_params
(
**params
)
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects
(such as :class:~sklearn.pipeline.Pipeline
). The latter have
parameters of the form <component>__<parameter>
so that it's
possible to update each component of a nested object.
**params
(dict) — Estimator parameters.
Estimator instance.
fit_transform
(
X
, y=None
, **fit_params
)
Fit to data, then transform it.
Fits transformer to X
and y
with optional parameters fit_params
and returns a transformed version of X
.
X
(array-like of shape (n_samples, n_features)) — Input samples.y
(array-like of shape (n_samples,) or (n_samples, n_outputs), default=None) — Target values (None for unsupervised transformations).**fit_params
(dict) — Additional fit parameters.
Transformed array.
CovarianceHierarchicalFilterAverage¶
skportfolio.riskreturn._risk_estimators.
CovarianceHierarchicalFilterAverage
(
returns_data=False
, frequency=252
)
Estimator of covariance based on hierarchical filtering approach.
fit_transform
(
X
,y
,**fit_params
)
(X_new : ndarray array of shape (n_samples, n_features_new)) — Fit to data, then transform it.get_params
(
deep
)
(params : dict) — Get parameters for this estimator.set_params
(
**params
)
(self : estimator instance) — Set the parameters of this estimator.
get_params
(
deep=True
)
Get parameters for this estimator.
deep
(bool, default=True) — If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
set_params
(
**params
)
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects
(such as :class:~sklearn.pipeline.Pipeline
). The latter have
parameters of the form <component>__<parameter>
so that it's
possible to update each component of a nested object.
**params
(dict) — Estimator parameters.
Estimator instance.
fit_transform
(
X
, y=None
, **fit_params
)
Fit to data, then transform it.
Fits transformer to X
and y
with optional parameters fit_params
and returns a transformed version of X
.
X
(array-like of shape (n_samples, n_features)) — Input samples.y
(array-like of shape (n_samples,) or (n_samples, n_outputs), default=None) — Target values (None for unsupervised transformations).**fit_params
(dict) — Additional fit parameters.
Transformed array.
CovarianceHierarchicalFilterComplete¶
skportfolio.riskreturn._risk_estimators.
CovarianceHierarchicalFilterComplete
(
returns_data=False
, frequency=252
)
Estimator of covariance based on hierarchical filtering approach.
fit_transform
(
X
,y
,**fit_params
)
(X_new : ndarray array of shape (n_samples, n_features_new)) — Fit to data, then transform it.get_params
(
deep
)
(params : dict) — Get parameters for this estimator.set_params
(
**params
)
(self : estimator instance) — Set the parameters of this estimator.
get_params
(
deep=True
)
Get parameters for this estimator.
deep
(bool, default=True) — If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
set_params
(
**params
)
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects
(such as :class:~sklearn.pipeline.Pipeline
). The latter have
parameters of the form <component>__<parameter>
so that it's
possible to update each component of a nested object.
**params
(dict) — Estimator parameters.
Estimator instance.
fit_transform
(
X
, y=None
, **fit_params
)
Fit to data, then transform it.
Fits transformer to X
and y
with optional parameters fit_params
and returns a transformed version of X
.
X
(array-like of shape (n_samples, n_features)) — Input samples.y
(array-like of shape (n_samples,) or (n_samples, n_outputs), default=None) — Target values (None for unsupervised transformations).**fit_params
(dict) — Additional fit parameters.
Transformed array.
CovarianceHierarchicalFilterSingle¶
skportfolio.riskreturn._risk_estimators.
CovarianceHierarchicalFilterSingle
(
returns_data=False
, frequency=252
)
Estimator of covariance based on hierarchical filtering approach.
fit_transform
(
X
,y
,**fit_params
)
(X_new : ndarray array of shape (n_samples, n_features_new)) — Fit to data, then transform it.get_params
(
deep
)
(params : dict) — Get parameters for this estimator.set_params
(
**params
)
(self : estimator instance) — Set the parameters of this estimator.
get_params
(
deep=True
)
Get parameters for this estimator.
deep
(bool, default=True) — If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
set_params
(
**params
)
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects
(such as :class:~sklearn.pipeline.Pipeline
). The latter have
parameters of the form <component>__<parameter>
so that it's
possible to update each component of a nested object.
**params
(dict) — Estimator parameters.
Estimator instance.
fit_transform
(
X
, y=None
, **fit_params
)
Fit to data, then transform it.
Fits transformer to X
and y
with optional parameters fit_params
and returns a transformed version of X
.
X
(array-like of shape (n_samples, n_features)) — Input samples.y
(array-like of shape (n_samples,) or (n_samples, n_outputs), default=None) — Target values (None for unsupervised transformations).**fit_params
(dict) — Additional fit parameters.
Transformed array.
CovarianceLedoitWolf¶
skportfolio.riskreturn._risk_estimators.
CovarianceLedoitWolf
(
returns_data=False
, frequency=252
, shrinkage_target='constant_variance'
)
Estimator of covariance based on the Ledoit-Wolf shrinkage
fit_transform
(
X
,y
,**fit_params
)
(X_new : ndarray array of shape (n_samples, n_features_new)) — Fit to data, then transform it.get_params
(
deep
)
(params : dict) — Get parameters for this estimator.set_params
(
**params
)
(self : estimator instance) — Set the parameters of this estimator.
get_params
(
deep=True
)
Get parameters for this estimator.
deep
(bool, default=True) — If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
set_params
(
**params
)
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects
(such as :class:~sklearn.pipeline.Pipeline
). The latter have
parameters of the form <component>__<parameter>
so that it's
possible to update each component of a nested object.
**params
(dict) — Estimator parameters.
Estimator instance.
fit_transform
(
X
, y=None
, **fit_params
)
Fit to data, then transform it.
Fits transformer to X
and y
with optional parameters fit_params
and returns a transformed version of X
.
X
(array-like of shape (n_samples, n_features)) — Input samples.y
(array-like of shape (n_samples,) or (n_samples, n_outputs), default=None) — Target values (None for unsupervised transformations).**fit_params
(dict) — Additional fit parameters.
Transformed array.
CovarianceRMT¶
skportfolio.riskreturn._risk_estimators.
CovarianceRMT
(
returns_data=False
, frequency=252
)
Estimator of covariance based on Random Matrix Theory
fit_transform
(
X
,y
,**fit_params
)
(X_new : ndarray array of shape (n_samples, n_features_new)) — Fit to data, then transform it.get_params
(
deep
)
(params : dict) — Get parameters for this estimator.set_params
(
**params
)
(self : estimator instance) — Set the parameters of this estimator.
get_params
(
deep=True
)
Get parameters for this estimator.
deep
(bool, default=True) — If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
set_params
(
**params
)
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects
(such as :class:~sklearn.pipeline.Pipeline
). The latter have
parameters of the form <component>__<parameter>
so that it's
possible to update each component of a nested object.
**params
(dict) — Estimator parameters.
Estimator instance.
fit_transform
(
X
, y=None
, **fit_params
)
Fit to data, then transform it.
Fits transformer to X
and y
with optional parameters fit_params
and returns a transformed version of X
.
X
(array-like of shape (n_samples, n_features)) — Input samples.y
(array-like of shape (n_samples,) or (n_samples, n_outputs), default=None) — Target values (None for unsupervised transformations).**fit_params
(dict) — Additional fit parameters.
Transformed array.
SemiCovariance¶
skportfolio.riskreturn._risk_estimators.
SemiCovariance
(
returns_data=False
, frequency=252
)
The semicovariance, a.k.a. the covariance matrix estimated from only the positive returns.
fit_transform
(
X
,y
,**fit_params
)
(X_new : ndarray array of shape (n_samples, n_features_new)) — Fit to data, then transform it.get_params
(
deep
)
(params : dict) — Get parameters for this estimator.set_params
(
**params
)
(self : estimator instance) — Set the parameters of this estimator.
get_params
(
deep=True
)
Get parameters for this estimator.
deep
(bool, default=True) — If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
set_params
(
**params
)
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects
(such as :class:~sklearn.pipeline.Pipeline
). The latter have
parameters of the form <component>__<parameter>
so that it's
possible to update each component of a nested object.
**params
(dict) — Estimator parameters.
Estimator instance.
fit_transform
(
X
, y=None
, **fit_params
)
Fit to data, then transform it.
Fits transformer to X
and y
with optional parameters fit_params
and returns a transformed version of X
.
X
(array-like of shape (n_samples, n_features)) — Input samples.y
(array-like of shape (n_samples,) or (n_samples, n_outputs), default=None) — Target values (None for unsupervised transformations).**fit_params
(dict) — Additional fit parameters.
Transformed array.