skfolio 0.3.0__py3-none-any.whl → 0.3.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -51,17 +51,20 @@ class ImpliedCovariance(BaseCovariance):
51
51
 
52
52
  with :math:`VRPA` the volatility risk premium adjustment.
53
53
 
54
- The covariance estimator is then used to compute the correlation matrix.
55
54
  The final step is the reconstruction of the covariance matrix from the correlation
56
55
  and estimated realised volatilities :math:`D`:
57
56
 
58
57
  .. math:: \Sigma = D \ Corr \ D
59
58
 
59
+ With :math:`Corr`, the correlation matrix computed from the prior covariance
60
+ estimator. The default is the `EmpiricalCovariance`. It can be changed to any
61
+ covariance estimator using `prior_covariance_estimator`.
62
+
60
63
  Parameters
61
64
  ----------
62
- covariance_estimator : BaseCovariance, optional
65
+ prior_covariance_estimator : BaseCovariance, optional
63
66
  :ref:`Covariance estimator <covariance_estimator>` to estimate the covariance
64
- matrix used for the correlation estimates.
67
+ matrix used for the correlation estimates prior the volatilities update.
65
68
  The default (`None`) is to use :class:`~skfolio.moments.EmpiricalCovariance`.
66
69
 
67
70
  annualized_factor : float, default=252
@@ -118,6 +121,9 @@ class ImpliedCovariance(BaseCovariance):
118
121
  covariance_ : ndarray of shape (n_assets, n_assets)
119
122
  Estimated covariance matrix.
120
123
 
124
+ prior_covariance_estimator_ : BaseEstimator
125
+ Fitted prior covariance estimator.
126
+
121
127
  pred_realised_vols_ : ndarray of shape (n_assets,)
122
128
  The predicted realised volatilities
123
129
 
@@ -160,7 +166,7 @@ class ImpliedCovariance(BaseCovariance):
160
166
  Sara Vikberg & Julia Björkman (2020).
161
167
  """
162
168
 
163
- covariance_estimator_: BaseCovariance
169
+ prior_covariance_estimator_: BaseCovariance
164
170
  pred_realised_vols_: np.ndarray
165
171
  linear_regressors_: list
166
172
  coefs_: np.ndarray
@@ -169,7 +175,7 @@ class ImpliedCovariance(BaseCovariance):
169
175
 
170
176
  def __init__(
171
177
  self,
172
- covariance_estimator: BaseCovariance | None = None,
178
+ prior_covariance_estimator: BaseCovariance | None = None,
173
179
  annualized_factor: float = 252.0,
174
180
  window_size: int = 20,
175
181
  linear_regressor: skb.BaseEstimator | None = None,
@@ -183,7 +189,7 @@ class ImpliedCovariance(BaseCovariance):
183
189
  higham=higham,
184
190
  higham_max_iteration=higham_max_iteration,
185
191
  )
186
- self.covariance_estimator = covariance_estimator
192
+ self.prior_covariance_estimator = prior_covariance_estimator
187
193
  self.annualized_factor = annualized_factor
188
194
  self.linear_regressor = linear_regressor
189
195
  self.window_size = window_size
@@ -195,7 +201,7 @@ class ImpliedCovariance(BaseCovariance):
195
201
  skm.MetadataRouter(owner=self.__class__.__name__)
196
202
  .add_self_request(self)
197
203
  .add(
198
- covariance_estimator=self.covariance_estimator,
204
+ prior_covariance_estimator=self.prior_covariance_estimator,
199
205
  method_mapping=skm.MethodMapping().add(caller="fit", callee="fit"),
200
206
  )
201
207
  )
@@ -237,15 +243,17 @@ class ImpliedCovariance(BaseCovariance):
237
243
 
238
244
  window_size = int(self.window_size)
239
245
  # fitting estimators
240
- self.covariance_estimator_ = check_estimator(
241
- self.covariance_estimator,
246
+ self.prior_covariance_estimator_ = check_estimator(
247
+ self.prior_covariance_estimator,
242
248
  default=EmpiricalCovariance(),
243
249
  check_type=BaseCovariance,
244
250
  )
245
251
  # noinspection PyArgumentList
246
- self.covariance_estimator_.fit(X, y, **routed_params.covariance_estimator.fit)
252
+ self.prior_covariance_estimator_.fit(
253
+ X, y, **routed_params.prior_covariance_estimator.fit
254
+ )
247
255
 
248
- corr, _ = cov_to_corr(self.covariance_estimator_.covariance_)
256
+ corr, _ = cov_to_corr(self.prior_covariance_estimator_.covariance_)
249
257
 
250
258
  assets_names = get_feature_names(X)
251
259
  if assets_names is not None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: skfolio
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: Portfolio optimization built on top of scikit-learn
5
5
  Author-email: Hugo Delatte <delatte.hugo@gmail.com>
6
6
  Maintainer-email: Hugo Delatte <delatte.hugo@gmail.com>
@@ -30,7 +30,7 @@ skfolio/moments/covariance/_empirical_covariance.py,sha256=_7T1x4p-vdATQvQzQjQBM
30
30
  skfolio/moments/covariance/_ew_covariance.py,sha256=jzLE4zSEfLCToNBTIG5CMy1n9EYWo1IHJPifcyLVe1g,3673
31
31
  skfolio/moments/covariance/_gerber_covariance.py,sha256=3wSwZtji2cEr2rzZ6pi2knmuOSzTFpyb_4XJl_S3Yj0,5856
32
32
  skfolio/moments/covariance/_graphical_lasso_cv.py,sha256=_6WQ1sjYJRG8XDq8zb5YIPtDhpb8CmLhLBlfewBvqjM,6539
33
- skfolio/moments/covariance/_implied_covariance.py,sha256=x0midsEr4RnJ63DMhv0zytoPCFqfGaV0WpxtnOeF75Y,17368
33
+ skfolio/moments/covariance/_implied_covariance.py,sha256=6DiPWo7WVRA8EFvjYxBLBIrYaeRJWpr8yH5I64Sbbd0,17732
34
34
  skfolio/moments/covariance/_ledoit_wolf.py,sha256=iV92TpAopOAgQwa4zk7NF1rYdXkgm3uXn5ZZpbcMss0,4875
35
35
  skfolio/moments/covariance/_oas.py,sha256=ru8BNz7vQU75ARCuUbtJstmR2fy2fiD9OXLDlztUm5g,3684
36
36
  skfolio/moments/covariance/_shrunk_covariance.py,sha256=OOUahkiSdU3vFOb8i0iHtn8WU0AHl7o9pf8pFkG6Lv4,3095
@@ -84,8 +84,8 @@ skfolio/utils/equations.py,sha256=w0HsYjA7cS0mHYsI9MpixHLkof3HN26nc14ZfqFrHlE,11
84
84
  skfolio/utils/sorting.py,sha256=lSjMvH2L-sSj-06B3MlwBrH1rtjCeGEe4hG894W7TE0,3504
85
85
  skfolio/utils/stats.py,sha256=wuOmSt5panMMTw_pFYizLbmrclsE_4PHQfamkzJ5J2s,13937
86
86
  skfolio/utils/tools.py,sha256=ADMk7sXiiM97JqGuhzDqv0V33DIDk2dwX7X9337dYmo,20572
87
- skfolio-0.3.0.dist-info/LICENSE,sha256=F6Gi-ZJX5BlVzYK8R9NcvAkAsKa7KO29xB1OScbrH6Q,1526
88
- skfolio-0.3.0.dist-info/METADATA,sha256=ABlRGykFqSR2RLECAvF_uhCCrC98w7Clg2pg8dSeRgk,19617
89
- skfolio-0.3.0.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91
90
- skfolio-0.3.0.dist-info/top_level.txt,sha256=NXEaoS9Ms7t32gxkb867nV0OKlU0KmssL7IJBVo0fJs,8
91
- skfolio-0.3.0.dist-info/RECORD,,
87
+ skfolio-0.3.1.dist-info/LICENSE,sha256=F6Gi-ZJX5BlVzYK8R9NcvAkAsKa7KO29xB1OScbrH6Q,1526
88
+ skfolio-0.3.1.dist-info/METADATA,sha256=Ydlm1DNyhoJOeimNLgJ8txU48mloWILIK223vqhB4A4,19617
89
+ skfolio-0.3.1.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
90
+ skfolio-0.3.1.dist-info/top_level.txt,sha256=NXEaoS9Ms7t32gxkb867nV0OKlU0KmssL7IJBVo0fJs,8
91
+ skfolio-0.3.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (70.1.1)
2
+ Generator: setuptools (70.2.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5