FeatureList

class pfhedge.features.FeatureList(features)[source]

Holds features in a list.

Parameters

features (list[str | Features]) – A list of features.

Examples

>>> from pfhedge.features import FeatureList
>>> from pfhedge.instruments import BrownianStock
>>> from pfhedge.instruments import EuropeanOption
>>>
>>> derivative = EuropeanOption(BrownianStock(), maturity=5/250)
>>> derivative.simulate(n_paths=2)
>>> f = FeatureList(["moneyness", "volatility", "empty"]).of(derivative)
>>> len(f)
3
>>> f.get(0).size()
torch.Size([2, 1, 3])