dotime.InterventionSpec

class dotime.InterventionSpec(targets, times, intervention_type, values)[source]

Bases: object

Specification of an intervention on a temporal SCM.

Attributes:

targets: List of variable indices to intervene on times: List of time indices when intervention is active intervention_type: Type of intervention (hard, soft, time-varying) values: Intervention values (constant, shift, or time-varying function)

Parameters:
__init__(targets, times, intervention_type, values)
Parameters:
Return type:

None

Methods

__init__(targets, times, intervention_type, ...)

from_dict(d)

Reconstruct an InterventionSpec from to_dict() output.

to_dict()

JSON-serializable view of the spec (round-trips via from_dict()).

Attributes

targets

times

intervention_type

values

targets: list[int]
times: list[int]
intervention_type: InterventionType
values: float | Tensor | Callable
to_dict()[source]

JSON-serializable view of the spec (round-trips via from_dict()).

The values field is encoded by kind: a scalar, a dense tensor list, or a named time-varying profile with its parameters.

Return type:

dict

classmethod from_dict(d)[source]

Reconstruct an InterventionSpec from to_dict() output.

Return type:

InterventionSpec

Parameters:

d (dict)