Finance#
Portfolio projection lives on the mixture itself
(project()); there is no
separate finance-layer wrapper.
Risk Measures#
Coherent risk measures for univariate normal-mixture portfolio returns.
The current implementation provides Conditional Value at Risk (CVaR), with
value, first derivatives, and second derivatives in both the projected
parameter space \((\tilde\mu, \tilde\gamma, \tilde\sigma)\) and the
portfolio-weight space \(w \in \mathbb{R}^d\). Formulas follow
docs/theory/cvar_derivatives.md.
CVaR integrates the conditional normal analytically over a positive
scenario measure of \(Y\). The default is deterministic quadrature;
an array supplies equal-weight Monte Carlo draws. Deterministic VaR uses
the Univariate* PINV ppf().
- class normix.finance.risk.RiskMeasure[source]#
Bases:
ModuleAbstract base for portfolio risk measures.
- abstractmethod value(univariate, scenarios=None)[source]#
Risk of the univariate normal mixture represented by
univariate.- Parameters:
univariate (_UnivariateNormalMixtureMixin)
scenarios (DiscreteMeasure | Array | None)
- Return type:
- abstractmethod value_reduced(mu, gamma, sigma, scenarios)[source]#
Risk from raw scalar parameters \((\tilde\mu, \tilde\gamma, \tilde\sigma)\).
The univariate normal mixture is \(\tilde\mu + \tilde\gamma Y + \tilde\sigma\sqrt{Y}Z\). Unlike
value(), this signature takes plain scalars (no distribution object) and must be Bessel-/PINV-free so it can bejax.vmap()-ed across an efficient-surface grid that shares the scenario measurescenarios.
- value_grad_hess_w(model, w, scenarios=None)[source]#
Fused \((r(w), \nabla_w r, H_r(w))\) under one shared scenario measure.
Consumed by
transaction_costsanddiversification. Concrete measures override with an analytically fused implementation (CVaR shares one conditional VaR solve); the base raises — a value-only measure cannot participate in the derivative-consuming layers.- Parameters:
model (NormalMixture)
w (Array)
scenarios (DiscreteMeasure | Array | None)
- Return type:
- class normix.finance.risk.CVaR(alpha)[source]#
Bases:
RiskMeasureConditional Value at Risk at tail probability \(\alpha \in (0, 1)\).
For a univariate normal mixture \(X = \tilde\mu + \tilde\gamma Y + \tilde\sigma \sqrt{Y} Z\), the value is computed in closed form conditional on \(Y\):
\[\operatorname{CVaR}_\alpha(X) = \frac{1}{\alpha} E_Y\!\left[ \tilde\sigma \sqrt{Y} \, \varphi(z_Y) - (\tilde\mu + \tilde\gamma Y) \Phi(z_Y) \right],\]where \(z_Y = (x_\alpha - \tilde\mu - \tilde\gamma Y) / (\tilde\sigma \sqrt{Y})\) and \(x_\alpha = -\operatorname{VaR}_\alpha\) is found by transformed bisection on the conditional CDF under the same measure as the integral.
scenarios=Noneuses subordinator quadrature. See Quadrature scenarios for mixture CVaR for accuracy and moment domains.Notes
At zero skew with divergent CVaR, derivatives represent limits under tail truncation, not classical derivatives of an infinite-valued function. The scalar scale derivative is \(+\infty\); its second derivative is zero because each truncated risk is linear in scale. Portfolio chain-rule terms preserve exact zero coefficients and otherwise retain the sign of the product with an infinite derivative.
- Parameters:
alpha (float)
- var(univariate)[source]#
\(\operatorname{VaR}_\alpha\) via deterministic PINV
ppf().- Parameters:
univariate (_UnivariateNormalMixtureMixin)
- Return type:
- value(univariate, scenarios=None)[source]#
Risk of the univariate normal mixture represented by
univariate.- Parameters:
univariate (_UnivariateNormalMixtureMixin)
scenarios (DiscreteMeasure | Array | None)
- Return type:
- value_reduced(mu, gamma, sigma, scenarios)[source]#
CVaR from raw scalar parameters, vectorizable over a surface grid.
Inverts the conditional CDF for \(x_\alpha\) by bisection on the component-quantile bracket \([\min_i q_i, \max_i q_i]\), \(q_i = \tilde\mu + \tilde\gamma Y_i + \tilde\sigma\sqrt{Y_i}\, \Phi^{-1}(\alpha)\). The bracket contains the root for every positive scenario measure. No PINV table and no Bessel evaluation; the CVaR integral is
_cvar_from_quantile.
- gradient_scalar(univariate, scenarios=None)[source]#
Return \((\partial r / \partial \tilde\mu, \partial r / \partial \tilde\gamma, \partial r / \partial \tilde\sigma)\).
- Parameters:
univariate (_UnivariateNormalMixtureMixin)
scenarios (DiscreteMeasure | Array | None)
- Return type:
- hessian_scalar(univariate, scenarios=None)[source]#
Return the \(3 \times 3\) Hessian in \((\tilde\mu, \tilde\gamma, \tilde\sigma)\).
\(\partial^2/\partial \tilde\mu \, \cdot = 0\) exactly; the other non-trivial blocks follow
docs/theory/cvar_derivatives.md(4).- Parameters:
univariate (_UnivariateNormalMixtureMixin)
scenarios (DiscreteMeasure | Array | None)
- Return type:
- value_w(model, w, scenarios=None)[source]#
- Parameters:
model (NormalMixture)
w (Array)
scenarios (DiscreteMeasure | Array | None)
- Return type:
- gradient_w(model, w, scenarios=None)[source]#
Gradient \(\nabla_w r_{\operatorname{CVaR}_\alpha}(w)\).
- Parameters:
model (NormalMixture)
w (Array)
scenarios (DiscreteMeasure | Array | None)
- Return type:
- hessian_w(model, w, scenarios=None)[source]#
Hessian \(H_{r_{\operatorname{CVaR}_\alpha}}(w)\).
- Parameters:
model (NormalMixture)
w (Array)
scenarios (DiscreteMeasure | Array | None)
- Return type:
- value_grad_hess_w(model, w, scenarios=None)[source]#
Fused \((r, \nabla_w r, H_r)\) with one conditional VaR solve.
Equivalent to calling
value_w(),gradient_w(), andhessian_w()separately, but projects once and bisects the conditional CDF once.- Parameters:
model (NormalMixture)
w (Array)
scenarios (DiscreteMeasure | Array | None)
- Return type:
- step_resolution(univariate, scenarios=None)[source]#
Transition width divided by local node spacing in \(\log Y\).
Reports \(R=1/(\rho_{loc}\,h)\) at the conditional-CDF step. A small value suggests increasing the node count; this is a heuristic, not an error bound. Returns infinity when there is no positive step, and zero when the step lies outside the node range. Duplicate and zero-mass nodes do not improve resolution.
- Parameters:
univariate (_UnivariateNormalMixtureMixin)
scenarios (DiscreteMeasure | Array | None)
- Return type:
Mean-Risk Optimization#
Mean-risk portfolio optimization for normal-mixture models.
For a multivariate normal mixture \(X \stackrel{d}{=} \mu + \gamma Y + \sqrt{Y} Z\) with \(Z \sim \mathcal{N}(0, \Sigma)\), the mean-risk problem
reduces — for any coherent risk measure \(\rho\) — to a two-dimensional problem in the reduced coordinates \(\tilde\mu = w^\top\mu\) and \(\tilde\gamma = w^\top\gamma\). The minimum-dispersion weights that realise a given \((\tilde\mu, \tilde\gamma)\) are
and the realised dispersion is \(g(\tilde\mu, \tilde\gamma) = [\tilde\mu\;\tilde\gamma\;1] A^{-1} [\tilde\mu\;\tilde\gamma\;1]^\top\). The map \((\tilde\mu, \tilde\gamma) \mapsto \rho\) is the efficient surface; its lower envelope under the return constraint is the efficient frontier.
The inverse formulae hold when \(A\) is nonsingular, that is when \(r = \operatorname{rank}[\mu\;\gamma\;e] = 3\). If \(r < 3\), the attainable pairs form an affine set \(\mathcal{S}\) of dimension \(r-1\). On \(\mathcal{S}\) the same formulae hold with the pseudoinverse \(A^{+}\) in place of \(A^{-1}\). A target outside \(\mathcal{S}\) is not a portfolio.
See Mean-Risk Optimization for Normal Mixture Distributions for the derivation.
- class normix.finance.optimization.EfficientSurface(mu_tilde, gamma_tilde, risk, expected_return)[source]#
Bases:
ModuleEfficient surface \((\tilde\mu, \tilde\gamma) \mapsto \rho\) on a grid.
risk[i, j]is the risk of the minimum-dispersion portfolio with reduced coordinates(mu_tilde[i], gamma_tilde[j]);expected_return[i, j] = mu_tilde[i] + gamma_tilde[j] * E[Y].
- class normix.finance.optimization.EfficientFrontier(expected_return, risk, mu_tilde, gamma_tilde, weights)[source]#
Bases:
ModuleMean-risk efficient frontier: minimum risk per target expected return.
Each entry is the solution of the reduced problem on the constraint line \(\tilde\mu + \tilde\gamma E[Y] = m\), including the realised portfolio
weightsof shape(K, d).- Parameters:
- class normix.finance.optimization.MeanRiskProblem(model, risk, scenarios=None)[source]#
Bases:
ModuleMean-risk optimization in reduced \((\tilde\mu, \tilde\gamma)\) coordinates.
Bundles a fitted
NormalMixtureand aRiskMeasure. All heavy evaluations share a fixed probability measure of the subordinator.scenarios=Nonebuilds quadrature once at construction. Supply an array for equal-weight Monte Carlo, or aDiscreteMeasurefor weighted scenarios. Per-call overrides share one measure across the whole grid or frontier. Expected returns continue to use the model law’s mean.The whitened factorisation of \(M = [\mu\;\gamma\;e]\) is computed once at construction. The Gram matrix \(A = M^\top\Sigma^{-1}M\) is stored for the minimum-dispersion anchor; it is positive semidefinite and need not be invertible. Weights use the truncated pseudoinverse of the whitened factor and are returned only for attainable targets.
- Parameters:
model (NormalMixture)
risk (RiskMeasure)
scenarios (DiscreteMeasure)
- model: NormalMixture#
- risk: RiskMeasure#
- scenarios: DiscreteMeasure#
- weights(mu_tilde, gamma_tilde)[source]#
Minimum-dispersion weights realising \((\tilde\mu, \tilde\gamma)\).
- Raises:
ValueError – If \((\tilde\mu, \tilde\gamma)\) is outside the reachable set. The message names each coordinate of \(M^\top w - c\) whose absolute residual exceeds
MEAN_RISK_REACH_ATOL.- Parameters:
- Return type:
- dispersion(mu_tilde, gamma_tilde)[source]#
Realised dispersion \(g(\tilde\mu, \tilde\gamma) = w^{*\top}\Sigma w^*\).
- Raises:
ValueError – If \((\tilde\mu, \tilde\gamma)\) is outside the reachable set.
- Parameters:
- Return type:
- min_dispersion_point()[source]#
Reduced coordinates \((\tilde\mu, \tilde\gamma)\) of the global minimum-dispersion portfolio \(w = \Sigma^{-1}e / (e^\top\Sigma^{-1}e)\).
The objective is \(w^\top\Sigma w\) subject to \(w^\top e = 1\), not \(w^\top\mathrm{Cov}(X)w\). A convenient anchor for choosing efficient-surface grid ranges.
- projection_at(mu_tilde, gamma_tilde)[source]#
Univariate portfolio return at \((\tilde\mu, \tilde\gamma)\).
Projects the minimum-dispersion
weights(); the result is aUnivariate*instance with location \(\tilde\mu\), skewness \(\tilde\gamma\), variance \(g(\tilde\mu, \tilde\gamma)\).- Parameters:
- Return type:
- risk_at(mu_tilde, gamma_tilde, scenarios=None)[source]#
Efficient-surface risk at a single \((\tilde\mu, \tilde\gamma)\).
- Parameters:
mu_tilde (Array)
gamma_tilde (Array)
scenarios (DiscreteMeasure | Array | None)
- Return type:
- efficient_surface(mu_tilde, gamma_tilde, scenarios=None)[source]#
Evaluate the efficient surface over the grid
mu_tilde × gamma_tilde.mu_tildeandgamma_tildeare 1-D arrays; the returnedriskhas shape(len(mu_tilde), len(gamma_tilde)). Memory scales aslen(mu_tilde) * len(gamma_tilde) * len(scenarios.Y). Every grid node must lie in the reachable set.- Raises:
ValueError – If any node lies outside the reachable set.
- Parameters:
mu_tilde (Array)
gamma_tilde (Array)
scenarios (DiscreteMeasure | Array | None)
- Return type:
- efficient_frontier(returns, scenarios=None, *, gamma_bounds, n_iter=48)[source]#
Minimum risk for each target expected return in
returns.For every target \(m\), minimises the risk along the part of \(\tilde\mu + \tilde\gamma E[Y] = m\) that lies in the reachable set and in
gamma_bounds. When the reachable set is a plane this is golden-section search in \(\tilde\gamma\). When it is a line, the return constraint selects one point of the line, or the whole line if the return is constant there. A constant return that misses the line, and any target off the reachable set, is infeasible. When the reachable set is a point, that portfolio is returned for its own expected return and every other return is infeasible.- Raises:
ValueError – If a target return is not attainable on the reachable set, or the feasible \(\tilde\gamma\) lies outside
gamma_bounds.- Parameters:
- Return type:
Transaction Costs#
Local-quadratic transaction-cost portfolio rebalancing.
The mean-risk problem with an \(\ell_1\) turnover penalty
cannot use the two-dimensional efficient-surface reduction, because the turnover term breaks translation invariance in the reduced coordinates. When costs keep the solution near the current portfolio \(w_0\), a second-order Taylor expansion of the convex risk \(r\) yields a convex quadratic program in buy/sell variables \(v = (v^+; v^-)\) with \(w = w_0 + v^+ - v^-\) (see Portfolio Optimization with Transaction Costs).
This module builds the QP matrices from any RiskMeasure
that supplies gradient_w() /
hessian_w(). Solving is optional and uses
scipy.optimize (already a core dependency); heavier QP backends can
consume the same matrices later.
- class normix.finance.transaction_costs.QuadraticApproximation(w0, value, gradient, hessian)[source]#
Bases:
ModuleLocal Taylor model of \(r\) at the current portfolio \(w_0\).
\[r(w) \approx r(w_0) + (w - w_0)^\top \nabla r(w_0) + \tfrac12 (w - w_0)^\top H_r(w_0)\,(w - w_0).\]
- class normix.finance.transaction_costs.TransactionCostQP(m_tilde, H_tilde, e_tilde, A_tilde, b_tilde, w0, c1, c2, approx, m)[source]#
Bases:
ModuleBuy/sell quadratic program for the local transaction-cost problem.
Maximises \(v^\top \tilde m - (c_1/2)\, v^\top \tilde H\, v\) over \(v \ge 0\) subject to \(v^\top \tilde e = 0\) and optional \(\tilde A v \le \tilde b\). Reconstruct \(w^* = w_0 + (I\;-I)\,v^*\).
- Parameters:
- A_tilde, b_tilde
Optional inequality block;
Nonewhen only the budget constraint is active.
- w0, c1, c2
Anchor portfolio and objective coefficients.
- approx#
Underlying risk Taylor model (for objective bookkeeping).
- class normix.finance.transaction_costs.TransactionCostResult(weights, v, turnover, approx_objective, hold_objective, improved, qp)[source]#
Bases:
ModuleSolution of the local transaction-cost QP.
improvedisTruewhen the approximate objective atweightsexceeds the hold objective; otherwise the theory recommends keeping \(w_0\) (see the note in Portfolio Optimization with Transaction Costs).- Parameters:
- normix.finance.transaction_costs.build_quadratic_approximation(risk, model, w0, scenarios=None)[source]#
Evaluate \(r(w_0)\), \(\nabla r(w_0)\), and \(H_r(w_0)\).
Uses
value_grad_hess_w()so the conditional VaR bisection runs once rather than three times.- Parameters:
risk (RiskMeasure)
model (NormalMixture)
w0 (Array)
scenarios (DiscreteMeasure | Array | None)
- Return type:
- normix.finance.transaction_costs.build_transaction_cost_qp(approx, m, c1, c2, A=None, b=None, hess_reg=1e-06)[source]#
Assemble the buy/sell QP matrices from a risk Taylor model.
- Parameters:
approx (QuadraticApproximation) – Local approximation of \(r\) at \(w_0\).
m (Array) – Expected-return vector (\(E[X]\) for a normal mixture).
A (Array | None) – Optional inequality \(A w \le b\) (same \(w_0\) must be feasible). Pass
Nonefor the budget-only problem.b (Array | None) – Optional inequality \(A w \le b\) (same \(w_0\) must be feasible). Pass
Nonefor the budget-only problem.hess_reg (float) – Absolute Tikhonov ridge on \(\tilde H\) so the QP is strictly convex (\(\tilde H\) has a nontrivial nullspace along \(v^+ = v^-\)). Unlike Newton, this is not scaled by \(\mathrm{tr}(\tilde H)\).
- Return type:
- normix.finance.transaction_costs.solve_transaction_cost_qp(qp, *, x0=None, options=None)[source]#
Solve the local QP with
scipy.optimize.minimize(SLSQP).Minimises \((c_1/2)\, v^\top \tilde H\, v - \tilde m^\top v\) subject to \(v \ge 0\), \(\tilde e^\top v = 0\), and optional \(\tilde A v \le \tilde b\). If the approximate objective does not beat holding \(w_0\), returns the hold portfolio.
- Parameters:
qp (TransactionCostQP)
x0 (Array | None)
- Return type:
- class normix.finance.transaction_costs.TransactionCostProblem(model, risk, c1, c2)[source]#
Bases:
ModuleLocal-quadratic transaction-cost rebalancing for a normal mixture.
Bundles a fitted
NormalMixtureand aRiskMeasurewith coefficients \((c_1, c_2)\). The risk object is reused unchanged — only its weight-space gradient and Hessian at \(w_0\) enter the QP.- Parameters:
model (NormalMixture)
risk (RiskMeasure)
c1 (float)
c2 (float)
- model: NormalMixture#
- risk: RiskMeasure#
- expected_return_vector()[source]#
Asset expected returns \(m = E[X] = \mu + \gamma\, E[Y]\).
- Return type:
- approximate(w0, scenarios=None)[source]#
Local Taylor model of risk at
w0under subordinator scenarios.- Parameters:
w0 (Array)
scenarios (DiscreteMeasure | Array | None)
- Return type:
- build_qp(w0, scenarios=None, *, m=None, A=None, b=None, hess_reg=1e-06)[source]#
Build the buy/sell QP at
w0.mdefaults toexpected_return_vector(). OptionalA,bencode \(A w \le b\) (e.g. long-only viaA = -I,b = 0).- Parameters:
- Return type:
- solve(w0, scenarios=None, *, m=None, A=None, b=None, hess_reg=1e-06, options=None)[source]#
Build and solve the local QP; see
solve_transaction_cost_qp().
Weight Functional#
Risk measures as JIT-able functions of portfolio weights.
WeightFunctional bundles a RiskMeasure,
a multivariate normal-mixture model, and a fixed subordinator measure into
a callable w -> ℝ with gradient and Hessian companions for optimisation.
- class normix.finance.functional.WeightFunctional(risk, model, scenarios=None)[source]#
Bases:
ModuleRisk measure as a function of weights, with frozen model and scenarios.
Bundles a
RiskMeasure, aNormalMixturemodel, and a probability measure of the subordinator into JIT-able callables intended for mean-risk optimisation (Phase E).- Parameters:
risk (RiskMeasure)
model (NormalMixture)
scenarios (DiscreteMeasure)
- risk: RiskMeasure#
- model: NormalMixture#
- scenarios: DiscreteMeasure#
Diversification#
Diversification analytics: effective number of bets under a torsion.
Variance ENB diagonalizes the return covariance \(\mathrm{Cov}[X] = E[Y]\Sigma + \mathrm{Var}[Y]\,\gamma\gamma^\top\) (Effective Number of Bets and Minimum Torsion); generalized ENB diagonalizes the Hessian of the squared coherent risk \(H_{r^2} = 2\nabla r\,\nabla r^\top + 2 r H_r\) (Generalized Effective Number of Bets). Both reduce to one core: normalize \(d_k v_k^2\) over a torsion \(T H T^\top = \operatorname{diag}(d)\), \(v = (T^\top)^{-1} w\), and exponentiate the entropy.
Minimum torsion is a diagonalization strategy, not a diversification measure.
- class normix.finance.diversification.TorsionDecomposition(T, T_inv_T, d, eigenvalues, valid)[source]#
Bases:
ModuleDiagonalization \(T H T^\top = \operatorname{diag}(d)\) of a PSD matrix.
T_inv_Tis \((T^\top)^{-1}\), the map from portfolio weights \(w\) to torsion-adjusted weights \(v\). Both concrete torsions supply it in closed form (no solve at evaluation time).eigenvaluesis the pre-clamp spectrum used for validity checks.validisFalsewhen a material negative eigenvalue was present.
- class normix.finance.diversification.Torsion[source]#
Bases:
ModuleStrategy: how to diagonalize a PSD matrix into uncorrelated bets.
- class normix.finance.diversification.MinimumTorsion[source]#
Bases:
TorsionConstrained minimum torsion (Meucci 2014): \(T = C^{-1/2}\operatorname{diag}(s)^{-1}\).
Closed form at \(D = I\). The iterative algorithm (unconstrained \(D\)) is deferred; it would land as a sibling
IterativeMinimumTorsionwithout touching callers.
- class normix.finance.diversification.PCATorsion[source]#
Bases:
TorsionPrincipal-components torsion (Meucci 2010): \(T = E^\top\), \(d = \Lambda\).
Rows ordered by descending eigenvalue. Eigenvector sign/order is unstable under near-ties — documented;
MinimumTorsionis the default.
- class normix.finance.diversification.ENBResult(enb, p, risk, v, d, T, eigenvalues)[source]#
Bases:
ModuleEffective number of bets and its decomposition at one portfolio.
pis normalized by \(\sum_k d_k v_k^2\) (a simplex up to floating point).riskis the 1-homogeneous risk whose square was diagonalized: portfolio volatility \(\sqrt{w^\top\Sigma_X w}\) forVarianceENB, \(\rho(w^\top X)\) forGeneralizedENB.enbis NaN when the local matrix is materially indefinite, the portfolio risk is non-positive, or the total contribution vanishes.
- class normix.finance.diversification.VarianceENB(torsion=MinimumTorsion())[source]#
Bases:
ModuleVariance-based effective number of bets (Effective Number of Bets and Minimum Torsion).
Diagonalizes the return covariance
model.cov()\(= E[Y]\Sigma + \mathrm{Var}[Y]\,\gamma\gamma^\top\) — not the dispersion \(\Sigma\). Deterministic: no subordinator sample. Requires a finiteVar[Y](same moment caveat asskewness()).- Parameters:
torsion (Torsion)
- evaluate(model, w)[source]#
ENB of \(w^\top X\) under the fitted model. Y-free by design.
vmap-able over a weight grid:
jax.vmap(enb.evaluate, in_axes=(None, 0)).- Parameters:
model (NormalMixture)
w (Array)
- Return type:
- class normix.finance.diversification.GeneralizedENB(risk, torsion=MinimumTorsion())[source]#
Bases:
ModuleENB of a squared coherent risk measure (Generalized Effective Number of Bets).
For 1-homogeneous \(\rho\), diagonalizes \(H_{r^2}(w) = 2\nabla r\,\nabla r^\top + 2 r H_r\) where \((r, \nabla r, H_r)\) come from one call to
risk.value_grad_hess_w(model, w, scenarios). Meaningful only for \(r(w) > 0\) (else \(r^2\) is not convex atwandenbis NaN).- Parameters:
risk (RiskMeasure)
torsion (Torsion)
- risk: RiskMeasure#
- evaluate(model, w, scenarios=None)[source]#
ENB at
wunder a fixed subordinator measure.Defaults to subordinator quadrature. Pass a shared measure or sample to reuse it across evaluations. Supports
vmapover weights.- Parameters:
model (NormalMixture)
w (Array)
scenarios (DiscreteMeasure | Array | None)
- Return type:
Scenario measures#
Discrete probability measures for conditional expectations.
See Quadrature scenarios for mixture CVaR for the quadrature construction and the finance identities preserved by positive weights.
- class normix.utils.quadrature.DiscreteMeasure(Y, log_p, tail_index=inf)[source]#
Bases:
ModuleProbability measure \(Q=\sum_j p_j\delta_{Y_j}\) on positive nodes.
- Parameters:
Y (Array) – Nonempty, finite, positive one-dimensional nodes.
log_p (Array) – Log weights with the same shape as
Y. Normalized at construction; \(-\infty\) denotes a zero weight. At least one must be finite.tail_index (Array) – Positive-moment threshold of the source law. Defaults to infinity for empirical measures. Quadrature retains the source threshold so truncation cannot hide a divergent risk or derivative.
- classmethod from_sample(Y)[source]#
Assign equal probabilities to a sample, preserving its order.
- Parameters:
Y (Array)
- Return type:
- classmethod from_weights(Y, w)[source]#
Normalize finite nonnegative weights with positive total mass.
- Parameters:
- Return type:
- classmethod coerce(scenarios, subordinator=None)[source]#
Use a measure, assign sample weights, or build subordinator quadrature.
Nonerequires a subordinator. Explicit measures retain their source law metadata and are returned unchanged.- Parameters:
scenarios (DiscreteMeasure | Array | None)
subordinator (ExponentialFamily | None)
- Return type: