babylon.models.metrics
Metrics data models for simulation observation and analysis.
These Pydantic models define the contract for MetricsCollector output, enabling unified metrics collection between the parameter sweeper and dashboard components.
Sprint 4.1: Phase 4 Dashboard/Sweeper unification. Sprint 4.1B: Expose meaningful metrics (economy drivers, topology, differentials).
Classes
|
Metrics snapshot for relationship edges at a specific tick. |
|
Metrics snapshot for a single entity at a specific tick. |
|
Summary statistics for a completed simulation run. |
|
Complete metrics snapshot for a single simulation tick. |
|
Topology metrics summary for phase transition detection. |
- class babylon.models.metrics.EntityMetrics(**data)[source]
Bases:
BaseModelMetrics snapshot for a single entity at a specific tick.
Captures wealth, consciousness, and survival probabilities for analysis and visualization.
- Parameters:
consciousness (Annotated[float, Ge(ge=0.0), Le(le=1.0), Ge(ge=0.0), Le(le=1.0)])
national_identity (Annotated[float, Ge(ge=0.0), Le(le=1.0), Ge(ge=0.0), Le(le=1.0)])
agitation (Annotated[float, Ge(ge=0.0), Le(le=1.0), Ge(ge=0.0), Le(le=1.0)])
p_acquiescence (Annotated[float, Ge(ge=0.0), Le(le=1.0), Ge(ge=0.0), Le(le=1.0)])
p_revolution (Annotated[float, Ge(ge=0.0), Le(le=1.0), Ge(ge=0.0), Le(le=1.0)])
organization (Annotated[float, Ge(ge=0.0), Le(le=1.0), Ge(ge=0.0), Le(le=1.0)])
- model_config: ClassVar[ConfigDict] = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- wealth: Currency
- consciousness: Probability
- national_identity: Probability
- agitation: Probability
- p_acquiescence: Probability
- p_revolution: Probability
- organization: Probability
- class babylon.models.metrics.EdgeMetrics(**data)[source]
Bases:
BaseModelMetrics snapshot for relationship edges at a specific tick.
Captures tension, value flows, and solidarity strength for analysis and visualization.
- Parameters:
- model_config: ClassVar[ConfigDict] = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- exploitation_tension: Probability
- exploitation_rent: Currency
- tribute_flow: Currency
- wages_paid: Currency
- solidarity_strength: Probability
- class babylon.models.metrics.TopologySummary(**data)[source]
Bases:
BaseModelTopology metrics summary for phase transition detection.
Captures the topological phase state of the simulation, including percolation ratio, cadre density, and phase classification.
- Parameters:
- model_config: ClassVar[ConfigDict] = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- percolation_ratio: Probability
- cadre_density: Probability
- num_components: int
- phase: Literal['gaseous', 'transitional', 'liquid', 'solid']
- class babylon.models.metrics.TickMetrics(**data)[source]
Bases:
BaseModelComplete metrics snapshot for a single simulation tick.
Aggregates entity and edge metrics for comprehensive tick analysis.
- Parameters:
p_w (EntityMetrics | None)
p_c (EntityMetrics | None)
c_b (EntityMetrics | None)
c_w (EntityMetrics | None)
edges (EdgeMetrics)
imperial_rent_pool (Annotated[float, Ge(ge=0.0), Ge(ge=0.0)])
global_tension (Annotated[float, Ge(ge=0.0), Le(le=1.0), Ge(ge=0.0), Le(le=1.0)])
current_repression_level (Annotated[float, Ge(ge=0.0), Le(le=1.0), Ge(ge=0.0), Le(le=1.0)])
pool_ratio (Annotated[float, Ge(ge=0.0), Le(le=1.0), Ge(ge=0.0), Le(le=1.0)])
topology (TopologySummary | None)
consciousness_gap (Annotated[float, Ge(ge=-1.0), Le(le=1.0)])
wealth_gap (float)
total_biocapacity (Annotated[float, Ge(ge=0.0), Ge(ge=0.0)])
total_consumption (Annotated[float, Ge(ge=0.0), Ge(ge=0.0)])
- model_config: ClassVar[ConfigDict] = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- tick: int
- p_w: EntityMetrics | None
- p_c: EntityMetrics | None
- c_b: EntityMetrics | None
- c_w: EntityMetrics | None
- edges: EdgeMetrics
- imperial_rent_pool: Currency
- global_tension: Probability
- current_super_wage_rate: float
- current_repression_level: Probability
- pool_ratio: Probability
- topology: TopologySummary | None
- consciousness_gap: float
- wealth_gap: float
- overshoot_ratio: float
- total_biocapacity: Currency
- total_consumption: Currency
- class babylon.models.metrics.SweepSummary(**data)[source]
Bases:
BaseModelSummary statistics for a completed simulation run.
Aggregates metrics across all ticks for parameter sweep analysis.
- Parameters:
outcome (Literal['SURVIVED', 'DIED', 'ERROR'])
max_tension (Annotated[float, Ge(ge=0.0), Le(le=1.0), Ge(ge=0.0), Le(le=1.0)])
peak_p_w_consciousness (Annotated[float, Ge(ge=0.0), Le(le=1.0), Ge(ge=0.0), Le(le=1.0)])
peak_c_w_consciousness (Annotated[float, Ge(ge=0.0), Le(le=1.0), Ge(ge=0.0), Le(le=1.0)])
- model_config: ClassVar[ConfigDict] = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- ticks_survived: int
- outcome: Literal['SURVIVED', 'DIED', 'ERROR']
- final_p_w_wealth: Currency
- final_p_c_wealth: Currency
- final_c_b_wealth: Currency
- final_c_w_wealth: Currency
- max_tension: Probability
- crossover_tick: int | None
- cumulative_rent: Currency
- peak_p_w_consciousness: Probability
- peak_c_w_consciousness: Probability