quantdata.dysanos.grid.rndysanos.quadratic_action#
Regularized conditional-action objectives for drift diagnostics.
This module deliberately does not construct a risk-neutral density. For
Y = a(z)' dH - kappa * ||a(z)||**2
is evaluated through the optimized-certainty-equivalent objective
sup_{a,y} E[u(Y+y)-y].
the first-order condition is
E[u'(Y) * (dH - 2*kappa*a(z)) | z] = 0.
Here the OCE first-order condition in y normalizes marginal utility to one.
The action condition consequently leaves conditional drift
2*kappa*a(z) under that marginal-utility density rather than zero. The
quadratic term makes the optimization coercive and is useful for learning
conditional drift without relying on an output cap.
- class quantdata.dysanos.grid.rndysanos.quadratic_action.DirectActionNetwork(env, *, num_input, num_output, config)[source]#
Bases:
BaseModelUnbounded feed-forward action with a neutral zero initialization.
- forward(z)[source]#
Forward method.
- Parameters:
data (dict) – Input data dictionary containing tensors for the model. The expected keys and tensor shapes depend on the specific model implementation.
training (bool, default
False) – Whether the model is in training mode.return_what (
BaseModel.ReturnWhat, defaultReturnWhat.LOSS_WEIGHT) – Specifies what the model should return. Options are: -ReturnWhat.LOSS_WEIGHT: return floatloss(with gradient) and floatweight(without gradient) for training. -ReturnWhat.VALUATION: returnloss,weightand a dictionary of additional float metrics. -ReturnWhat.PATHWISE: return pathwise metrics as dictionary.
- class quantdata.dysanos.grid.rndysanos.quadratic_action.QuadraticActionConfig(*, utility='entropy', lmbda=1.0, downside_power=2, quadratic_coefficient=0.5, bounded_action=False, initial_action_scale=1.0, network_config=FeedForwardConfig(activation='LeakyReLU', num_depth=2, num_width=100, use_bias=True))[source]#
Bases:
objectLogical configuration of the regularized action experiment.
- network_config: FeedForwardConfig = FeedForwardConfig(activation='LeakyReLU', num_depth=2, num_width=100, use_bias=True)#
- class quantdata.dysanos.grid.rndysanos.quadratic_action.QuadraticActionModel(env, *, num_input, num_instruments, config)[source]#
Bases:
BaseModelConditional portfolio with a quadratic position charge inside utility.
- forward(data)[source]#
Forward method.
- Parameters:
data (
Mapping[str,Tensor]) – Input data dictionary containing tensors for the model. The expected keys and tensor shapes depend on the specific model implementation.training (bool, default
False) – Whether the model is in training mode.return_what (
BaseModel.ReturnWhat, defaultReturnWhat.LOSS_WEIGHT) – Specifies what the model should return. Options are: -ReturnWhat.LOSS_WEIGHT: return floatloss(with gradient) and floatweight(without gradient) for training. -ReturnWhat.VALUATION: returnloss,weightand a dictionary of additional float metrics. -ReturnWhat.PATHWISE: return pathwise metrics as dictionary.
- quantdata.dysanos.grid.rndysanos.quadratic_action.conditional_gaussian_entropy_action(mean, covariance, *, lmbda, quadratic_coefficient)[source]#
Return
(2*kappa*I + lambda*Sigma)^{-1} mean.
- quantdata.dysanos.grid.rndysanos.quadratic_action.downside_oce_utility(x, y, *, scale, power)[source]#
Return
-scale*(-(x+y))_+**power-yand its derivative inx.
- quantdata.dysanos.grid.rndysanos.quadratic_action.iter_path_batches(data, batch_size)[source]#
Yield complete-path batches without changing any within-path reduction.
- quantdata.dysanos.grid.rndysanos.quadratic_action.objective_gradient(model, data, *, batch_size)[source]#
Differentiate the exact full-split empirical objective in path batches.