Capacities
The finite-capacity formulation used by the package follows the theory initiated by Choquet (1954) and the modern treatments of Torra, Narukawa and Sugeno (2014) and Beliakov, James and Wu (2026). See the theoretical background for its role as a non-additive aggregation model.
Definition
For a finite universe \(N\), a capacity is a normalized monotone set function
satisfying
and
Unlike an additive probability measure, a capacity does not require
for disjoint \(A\) and \(B\). This is what allows coalitions of variables to encode complementarity or redundancy.
Variable universes
The package represents the finite universe through VariableUniverse.
from capacities_ml_fin.base.capacities import VariableUniverse
universe = VariableUniverse(("profitability", "liquidity", "volatility"))
It stores:
var_names: the ordered names;n_elements: the number of elements;name_to_index: a read-only name-to-index mapping.
A generated universe can also be created with:
Inferred universes
ExplicitCapacity and MobiusCapacity can infer the universe from coalition keys. If keys are named, names are retained in their first observed order. If keys are integer indices, the smallest universe containing the largest index is created.
from capacities_ml_fin.base.capacities import ExplicitCapacity
capacity = ExplicitCapacity(
{
"quality": 0.4,
"speed": 0.3,
("quality", "speed"): 1.0,
}
)
capacity.var_names
For intentionally sparse inputs that do not mention every variable, pass n_elements=, var_names=, or a prebuilt universe= explicitly.
ExplicitCapacity
ExplicitCapacity stores the table of capacity values directly.
For \(n\) variables, a complete explicit capacity contains one value for each non-empty coalition. The empty coalition is not supplied: its value is fixed to zero.
capacity = ExplicitCapacity(
values={
"a": 0.20,
"b": 0.30,
"c": 0.25,
("a", "b"): 0.60,
("a", "c"): 0.55,
("b", "c"): 0.65,
("a", "b", "c"): 1.00,
}
)
The constructor calls validate(), so non-normalized or non-monotone tables are rejected at construction time.
Access by coalition
Access by Boolean event
Generic algorithms should use an event mask:
The event above corresponds to the coalition \(\{a,b\}\).
Named table
This is useful for display, serialization, and debugging.
Common BaseCapacity interface
All capacity classes implement two key operations:
event_value(event) evaluates an arbitrary event. nested_event_values(order) evaluates the nested upper sets induced by an ordering of the variables. The latter operation is central to the ordered Choquet integral and lets sparse capacity implementations avoid materializing the complete \(2^n\) table.
This interface is implemented not only by ExplicitCapacity and MobiusCapacity, but also by risk-specific classes such as ProbabilityCapacity, DistortedCapacity, UpperEnvelopeCapacity, and LowerEnvelopeCapacity.
Validation
validate_capacity checks normalization and monotonicity by exhaustive enumeration for finite capacities:
For large universes the number of events grows exponentially, so max_elements exists as an explicit safety limit.
The package also exposes:
A concave/submodular capacity satisfies
while a convex/supermodular capacity satisfies the reverse inequality.
These checks also enumerate event pairs and therefore intentionally use a smaller default safety limit than basic monotonicity validation.
Capacity values versus Möbius coefficients
This distinction is essential when using the API:
For representation-independent code:
both return the corresponding capacity value \(\mu(\{a,b\})\).
Immutability
Capacity objects are frozen after successful validation. The low-level CapacityMap and MobiusMap are immutable as well. To change a capacity, construct a new object rather than mutating a coalition in place. This prevents a previously validated capacity from becoming mathematically invalid after construction.