skfolio 0.9.0__py3-none-any.whl → 0.9.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.
@@ -256,9 +256,6 @@ class MaximumDiversification(MeanRisk):
256
256
  min_return : float | array-like of shape (n_optimization), optional
257
257
  Lower bound constraint on the expected return.
258
258
 
259
- min_return : float | array-like of shape (n_optimization), optional
260
- Lower bound constraint on the expected return.
261
-
262
259
  add_objective : Callable[[cp.Variable], cp.Expression], optional
263
260
  Add a custom objective to the existing objective expression.
264
261
  It is a function that must take as argument the weights `w` and returns a
@@ -902,7 +902,7 @@ class MeanRisk(ConvexOptimization):
902
902
  )
903
903
  constraints += [
904
904
  tracking_error * self._scale_constraints
905
- <= self.max_tracking_error * self._scale_constraints
905
+ <= self.max_tracking_error * factor * self._scale_constraints
906
906
  ]
907
907
 
908
908
  # Turnover
@@ -1036,6 +1036,15 @@ class MeanRisk(ConvexOptimization):
1036
1036
  + custom_objective * self._scale_objective
1037
1037
  )
1038
1038
  case ObjectiveFunction.MAXIMIZE_RATIO:
1039
+ # Capture common obvious mistake before solver failure to help user
1040
+ if np.isscalar(self.min_weights) and self.min_weights >= 0:
1041
+ if np.max(prior_model.mu) - self.risk_free_rate <= 0:
1042
+ raise ValueError(
1043
+ "Cannot optimize for Maximum Ratio with your current "
1044
+ "constraints and input. This is because your assets' "
1045
+ "expected returns are all under-performing your risk-free "
1046
+ f"rate {self.risk_free_rate:.2%}."
1047
+ )
1039
1048
  homogenization_factor = _optimal_homogenization_factor(
1040
1049
  mu=prior_model.mu
1041
1050
  )
@@ -1060,7 +1069,6 @@ class MeanRisk(ConvexOptimization):
1060
1069
  # Fractional Programming Problems".
1061
1070
  # The condition to work is f1 >= 0, so we need to raise an user
1062
1071
  # warning when it's not the case.
1063
- # TODO: raise user warning when f1<0
1064
1072
 
1065
1073
  constraints += [
1066
1074
  expected_return * self._scale_constraints
@@ -123,7 +123,7 @@ class SelectNonExpiring(skf.SelectorMixin, skb.BaseEstimator):
123
123
  )
124
124
 
125
125
  if self.expiration_dates is None:
126
- raise ValueError("`expiration_lookahead` must be provided")
126
+ raise ValueError("`expiration_dates` must be provided")
127
127
 
128
128
  if self.expiration_lookahead is None:
129
129
  raise ValueError("`expiration_lookahead` must be provided")
@@ -276,7 +276,7 @@ def _matching_array(values: np.ndarray, key: str, sum_to_one: bool) -> np.ndarra
276
276
  if not arr.any():
277
277
  raise EquationToMatrixError(f"Unable to find '{key}' in '{values}'")
278
278
  if sum_to_one:
279
- s = np.sum(arr)
279
+ s = arr.sum()
280
280
  else:
281
281
  s = 1
282
282
  return arr / s
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: skfolio
3
- Version: 0.9.0
3
+ Version: 0.9.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>, Matteo Manzi <matteomanzi09@gmail.com>
@@ -74,8 +74,8 @@ skfolio/optimization/cluster/hierarchical/_hrp.py,sha256=06kch9QkthV5yB8RNB_5Xz-
74
74
  skfolio/optimization/convex/__init__.py,sha256=q1Q2p7HcnmbQlBIA0SXm0TwDGxl7hRc0JhF1o01lFSg,605
75
75
  skfolio/optimization/convex/_base.py,sha256=mUTXVM6bq5cvlieAl6TXNGd6BNIqBajoAiDL28fPx9o,89455
76
76
  skfolio/optimization/convex/_distributionally_robust.py,sha256=4iWfEuJGuBawVGU5X1-QHVMMh9hBnMtou2Uh5hRdXeA,17958
77
- skfolio/optimization/convex/_maximum_diversification.py,sha256=a8nDecN6jTR_bOFKBsenI4G2kNu5t98y5ALY78lNrAU,19657
78
- skfolio/optimization/convex/_mean_risk.py,sha256=mM5KMCxwAf1dT6JTxJuuQfvvk63hMQg5GD3LumQkfjQ,49534
77
+ skfolio/optimization/convex/_maximum_diversification.py,sha256=hYnzmHjVrc0gGIrGsMuc0ptGqKJNSU5t16DIjSErYHM,19529
78
+ skfolio/optimization/convex/_mean_risk.py,sha256=Puj-OUBwV-0y4vbNwwNVKTQqf1YuwQxqf8pknOTZ3ec,50105
79
79
  skfolio/optimization/convex/_risk_budgeting.py,sha256=xtRg3CGmasi-ebx7e5XevHJs3n9PpccaZR7Z7loyKDc,23653
80
80
  skfolio/optimization/ensemble/__init__.py,sha256=IJhsX8f-6wclc9a6Fd8yAQvZKxtxq4Qf7AC2CLryHrU,195
81
81
  skfolio/optimization/ensemble/_base.py,sha256=e0dWCEIYnho3HU2KGGS9UHQdycdVuqMcTe7hi0LihjQ,3416
@@ -94,7 +94,7 @@ skfolio/pre_selection/_drop_zero_variance.py,sha256=66Mi0Fta1kdmLw0CCqa7p9AqpoBp
94
94
  skfolio/pre_selection/_select_complete.py,sha256=2nEvcjROMJzhAHMCHADeAiCws_tc-BMtndIkjRexL84,3902
95
95
  skfolio/pre_selection/_select_k_extremes.py,sha256=nMugK88igmscribCw_I1UnjE_O7cuIjrJF8AGuVTfiA,3082
96
96
  skfolio/pre_selection/_select_non_dominated.py,sha256=Auv7G8E1QNO96heb35oBWmFLd68LlVDRgSpcg7wpv5A,6004
97
- skfolio/pre_selection/_select_non_expiring.py,sha256=hVXLNw5KBU7WxOI6v4feZ9lJaVIgl-CBhW80T9-ZUac,5105
97
+ skfolio/pre_selection/_select_non_expiring.py,sha256=g7ekl69MxQFkg06Km3NiuJXr0JfYPqvo5hMLQsIcUKY,5101
98
98
  skfolio/preprocessing/__init__.py,sha256=94jMyP_E7FlwQVE8D_bXDi8KyfAA2xPHTDvYOi6zf_g,123
99
99
  skfolio/preprocessing/_returns.py,sha256=6G5qJIVHGnIoeBNAqpJTB-569g9NeXVIyrz033bK5Gk,4576
100
100
  skfolio/prior/__init__.py,sha256=daUO3ha87Nu0ixJci33dR1dKgoYC6-1Nf3AUoaskE5o,544
@@ -110,12 +110,12 @@ skfolio/uncertainty_set/_bootstrap.py,sha256=tDnUvhTtl0HWu-xL6MWZZZyWs4Y06PKQ5xP
110
110
  skfolio/uncertainty_set/_empirical.py,sha256=t9_V23gH1eJ0jaASQcus-QOSATAr9HKVW2hjHMNYjO0,9380
111
111
  skfolio/utils/__init__.py,sha256=bC6-MsCVF7xKTr48z7OzJJUeWvqAB7BiHeNTiKsme70,20
112
112
  skfolio/utils/bootstrap.py,sha256=6BN_9CgfbeImBSNEE0dF52FRGuQT41HcQXeHPLwFqJc,3565
113
- skfolio/utils/equations.py,sha256=yj6-TReoPq3YaUQyAx-t4wZNbODON2T4TyA82z2SnkU,15577
113
+ skfolio/utils/equations.py,sha256=ZDEAapAfWeiOHvQbboswSqfQInlQklKJDtkiV__d-sc,15575
114
114
  skfolio/utils/sorting.py,sha256=F7gfIBfnulfDUiqvzrlR-pba4PPLJT6NH7-5s4sdRhw,3521
115
115
  skfolio/utils/stats.py,sha256=glVHo7rjwy06dl5kkULLOADMrEkVJcfXXAz-1qmYQL4,17005
116
116
  skfolio/utils/tools.py,sha256=sGJFiqc60TqXyaWoH7JdsbaFYj_bvwq3hHIk6FxDC3U,22994
117
- skfolio-0.9.0.dist-info/licenses/LICENSE,sha256=F6Gi-ZJX5BlVzYK8R9NcvAkAsKa7KO29xB1OScbrH6Q,1526
118
- skfolio-0.9.0.dist-info/METADATA,sha256=_qGGSm5oQZaU1lYBcKTfslMYdmLJ1oe3pQK0MCTUhOQ,22383
119
- skfolio-0.9.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
120
- skfolio-0.9.0.dist-info/top_level.txt,sha256=NXEaoS9Ms7t32gxkb867nV0OKlU0KmssL7IJBVo0fJs,8
121
- skfolio-0.9.0.dist-info/RECORD,,
117
+ skfolio-0.9.1.dist-info/licenses/LICENSE,sha256=F6Gi-ZJX5BlVzYK8R9NcvAkAsKa7KO29xB1OScbrH6Q,1526
118
+ skfolio-0.9.1.dist-info/METADATA,sha256=139u03mcy89z6d922cjhRPNqr-Buh1NT4TIvPFX4sB0,22383
119
+ skfolio-0.9.1.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
120
+ skfolio-0.9.1.dist-info/top_level.txt,sha256=NXEaoS9Ms7t32gxkb867nV0OKlU0KmssL7IJBVo0fJs,8
121
+ skfolio-0.9.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.1.0)
2
+ Generator: setuptools (80.7.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5