mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-16 17:12:20 +08:00
This commit is contained in:
@@ -36,21 +36,21 @@ class StructuredCovEstimator(RiskModel):
|
|||||||
self,
|
self,
|
||||||
factor_model: str = "pca",
|
factor_model: str = "pca",
|
||||||
num_factors: int = 10,
|
num_factors: int = 10,
|
||||||
assume_centered: bool = False,
|
**kwargs
|
||||||
scale_return: bool = True,
|
|
||||||
nan_option: str = DEFAULT_NAN_OPTION
|
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
factor_model (str): the latent factor models used to estimate the structured covariance (`pca`/`fa`).
|
factor_model (str): the latent factor models used to estimate the structured covariance (`pca`/`fa`).
|
||||||
num_factors (int): number of components to keep.
|
num_factors (int): number of components to keep.
|
||||||
assume_centered (bool): whether the data is assumed to be centered.
|
kwargs: see `RiskModel` for more information
|
||||||
scale_return (bool): whether scale returns as percentage.
|
|
||||||
nan_option (str): nan handling option (`fill`).
|
|
||||||
"""
|
"""
|
||||||
assert nan_option in [self.DEFAULT_NAN_OPTION], "nan_option={} is not supported".format(nan_option)
|
if 'nan_option' in kwargs.keys():
|
||||||
|
assert kwargs['nan_option'] in [self.DEFAULT_NAN_OPTION], \
|
||||||
|
"nan_option={} is not supported".format(kwargs['nan_option'])
|
||||||
|
else:
|
||||||
|
kwargs['nan_option'] = self.DEFAULT_NAN_OPTION
|
||||||
|
|
||||||
super().__init__(nan_option, assume_centered, scale_return)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
assert factor_model in [
|
assert factor_model in [
|
||||||
self.FACTOR_MODEL_PCA,
|
self.FACTOR_MODEL_PCA,
|
||||||
|
|||||||
Reference in New Issue
Block a user