energy_methods.thermal_counterfactual#
Comfort-event and paired intervention scoring, independent of predictor type.
- energy_methods.thermal_counterfactual.comfort_time(minutes, temperature, *, threshold_c=20.75, consecutive=2, not_before_min=None)[source]#
First sustained heating-threshold crossing, linearly interpolated in minutes.
Require
consecutivesamples at or above threshold. Return None if the event is right-censored by the horizon; never substitute the horizon as an observed event. If already comfortable at the first sample, return that sample’s time (left-censored). Inputs must be finite and strictly ordered.not_before_minrestricts scoring to samples at/after an eligibility time, reproducing the source’s start-gated metric. This is a heating criterion, not a two-sided comfort band or cooling metric.- Parameters:
minutes (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])
temperature (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])
threshold_c (float)
consecutive (int)
not_before_min (float | None)
- Return type:
float | None
- energy_methods.thermal_counterfactual.paired_shift_error(predicted, reference, actual, actual_reference)[source]#
Predicted minus simulated change, in minutes; positive means overresponse.
All four comfort events must be observed. Missing events remain censored.
- Parameters:
predicted (float | None)
reference (float | None)
actual (float | None)
actual_reference (float | None)
- Return type:
float | None