Entropy Pooling
Reweight the historical periods so that they agree with views on the assets, by Entropy Pooling (Meucci, 2008).
These are the probabilities of the periods closest to equal probabilities in relative entropy, \(\sum p_{t} \ln (p_{t} T)\), under which the views hold. The returns themselves stay as they were, so the posterior keeps the fat tails and co-movements of the history; only how much each period counts changes. The posterior expected returns and covariance matrix follow from the probabilities.
Views are annualized, like those of get_black_litterman_weights:
- views: the expected return of an asset ({“AAPL”: 0.10}, an arithmetic return a year) or the difference of two ({“AAPL-MSFT”: 0.02}).
- volatility_views: the annualized volatility of an asset ({“AAPL”: 0.25}).
- correlation_views: the correlation of two assets ({“AAPL-MSFT”: 0.5}).
- ranking: an ordering of the expected returns, from the highest to the lowest ([“XOM”, “MSFT”, “AAPL”]), the ranking views of Meucci (2008): the inequalities \(E_{p} [r_{k + 1}] \leq E_{p} [r_{k}]\) for every pair of neighbours, imposed with the views on the expected returns. Only the order is stated, not by how much.
A view is an equality (a number) or an inequality, a pair (“>=”, 0.10) or (“<=”, 0.10). The views on volatilities hold the means found with the mean views, and the views on correlations hold both the means and the volatilities, the sequential treatment of Meucci, Ardia and Keel (2011), in the order skfolio’s EntropyPooling takes them. The problem is solved through its dual with SciPy’s L-BFGS-B.
With opinions, a list of views of several experts, each a dictionary with the keys “views”, “volatility_views”, “correlation_views” and “ranking”, every opinion gets its own posterior and these are pooled with the opinion weights (equal by default; any weight left to sum to one goes to the equal prior probabilities): linearly, \(p = \sum \pi_{k} p_{k}\) (Stone, 1961), or logarithmically, p ∝ \(\Pi p_{k,k}^{\pi}\) (Genest and Zidek, 1986), optionally weighing down opinions far from the consensus by exp(-α KL(p_k ‖ c)) with \(\alpha\) the divergence penalty.
Also known as: fully flexible views, fully flexible probabilities, opinion pooling, views on scenarios, ranking views, ordering views.
Example · AAPL, MSFT, JNJ, XOM · 2021 to 2025
Install the Finance Toolkit with pip install financetoolkit -U, then call get_entropy_pooling:
from financetoolkit import Toolkit
toolkit = Toolkit(
["AAPL", "MSFT", "JNJ", "XOM"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2021-01-01",
end_date="2025-12-31",
)
toolkit.portfolio.get_entropy_pooling(
views={"AAPL": 0.05, "XOM-JNJ": (">=", 0.02)},
volatility_views={"MSFT": 0.30},
)
Which returns:
| Item | Prior Return | Posterior Return | Prior Volatility | Posterior Volatility |
|---|---|---|---|---|
| AAPL | 0.1932 | 0.0500 | 0.2786 | 0.3151 |
| MSFT | 0.2017 | 0.1180 | 0.2571 | 0.3000 |
| JNJ | 0.0987 | 0.0697 | 0.1673 | 0.1696 |
| XOM | 0.2911 | 0.2640 | 0.2702 | 0.2763 |
4 rows
Parameters
get_entropy_pooling accepts the following parameters.
| Parameter | Type | Description | Example |
|---|---|---|---|
views | dict | None | The annualized expected return views. Defaults to None. | None |
volatility_views | dict | None | The annualized volatility views. Defaults to None. | None |
correlation_views | dict | None | The correlation views. Defaults to None. | None |
ranking | list[str] | None | Assets from the highest expected return to the lowest, at least two. Defaults to None. | None |
opinions | list[dict] | None | The views of several experts to pool, instead of views, volatility_views, correlation_views and ranking. Defaults to None. | None |
opinion_weights | list[float] | None | The weight of every opinion, summing to at most one. Defaults to None, equal weights. | None, equal weights |
pooling | str | How the opinions are pooled. Options are: “linear” (arithmetic mixture), “logarithmic” (geometric mixture). Defaults to “linear”. | "linear" |
divergence_penalty | float | The penalty \(\alpha\) on an opinion’s relative entropy to the consensus. Defaults to 0. | 0 |
output | str | Options are: “moments” (the prior and posterior expected return and volatility per asset), “covariance” (the posterior covariance matrix), “probabilities” (the prior and posterior probability of every period), “summary” (the relative entropy and the effective number of periods). Defaults to “moments”. | "moments" |
period | str | The frequency of the returns. Options are: “daily” (daily returns), “weekly” (weekly returns), “monthly” (monthly returns), “quarterly” (quarterly returns), “yearly” (yearly returns). Defaults to “daily”. | "weekly" |
include_benchmark | bool | Whether to include the benchmark as an asset. Defaults to False. | True |
rounding | int | None | The number of decimals to round the results to. Defaults to None, which uses the Toolkit’s rounding. | 2 |
show_columns | str | list[str] | None | The columns to keep, a name or a list of names, matched on every column level, or the rows when no column has those names (such as the line items of a financial statement). Names that do not exist are logged, and when none exist the result is returned in full. Defaults to None, which keeps every column. | None, which keeps every column |
References
- Paper Meucci, A. (2008). “Fully Flexible Views: Theory and Practice.” Risk, 21(10), 97-102.
- Paper Stone, M. (1961). “The Opinion Pool.” The Annals of Mathematical Statistics, 32(4), 1339-1342.
- Paper Genest, C. and Zidek, J. V. (1986). “Combining Probability Distributions: A Critique and an Annotated Bibliography.” Statistical Science, 1(1), 114-135.
- Library Referenced against skfolio’s EntropyPooling
- Library Referenced against skfolio’s OpinionPooling