forked from BlockScience/subspace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.py
30 lines (22 loc) · 1019 Bytes
/
types.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from subspace_model.types import *
import pandas as pd # type: ignore
from typing import Callable, Optional, NamedTuple
## Types
# A Tensor with (simulation, subset, run, timestep) dimensions
TimestepTensor = pd.DataFrame
# A subset of the TimestepTensor on which there's a single unique value for each of (simulation, subset, run) across the dataset.
TrajectoryDataFrame = TimestepTensor
# A Tensor with (simulation, subset, run) dimensions
TrajectoryTensor = pd.DataFrame
KPI = float
SuccessThreshold = Optional[bool]
KPIWeights = dict[str, float]
GoalUtility = float
GoalThreshold = Optional[bool]
TrajectoryKPIFunction = Callable[[TrajectoryDataFrame], KPI] # type: ignore
TrajectoryThreshold = Callable[[KPI, list[KPI]], SuccessThreshold]
TrajectoryGoalUtility = Callable[[dict[str, KPI]], GoalUtility]
TrajectoryGoalThreshold = Callable[[GoalThreshold, list[GoalThreshold]], GoalThreshold]
class TrajectoryKPIandThreshold(NamedTuple):
kpi_function: TrajectoryKPIFunction
threshold_function: str