energy_analysis_toolbox.thermosensitivity.daily_analysis module#

Analyze daily-sampled thermosensitivity data.

class energy_analysis_toolbox.thermosensitivity.daily_analysis.AutoCategoricalThermoSensitivity(energy_data: Series, temperature_data: Series, degree_days_type: Literal['heating', 'cooling', 'both', 'auto'] = 'heating', degree_days_base_temperature: dict | None = None, degree_days_computation_method: Literal['min_max', 'mean', 'integral', 'pro'] = 'integral', interseason_mean_temperature: float = 20, base_logger_name: str | None = None, min_logger_level_stdout: int | str = 40)[source]#

Bases: DayOfWeekCategoricalThermoSensitivity

Automatically categorizes thermosensitivity data based on predefined criteria.

Based on DayOfWeekCategoricalThermoSensitivity.

property categories: Series#

The categories of the periods.

merge_and_fit(significant_level: float = 0.1) None[source]#

Merge similar categories and fit the model with updated categories.

This method merges categories that exhibit similar thermosensitivity based on their interaction term significance and then refits the model using the updated categorization. This helps reduce model complexity by grouping categories with similar behavior.

Parameters:

significant_level (float, optional) – The significance level for the Wald test (a p-value below this level is considered significant). Must be between 0 and 1. The higher the value, the more categories will be kept separate. Lower values will merge categories that are not significantly different.

Returns:

None

Notes

  • The method first calculates new categories using the new_categories method, then assigns these new categories and fits the model to reflect the updated categorization.

  • This process is especially useful for reducing overfitting by combining similar days (e.g., merging weekdays that do not show significant thermosensitivity differences).

new_categories(significant_level: float = 0.1) dict[source]#

Return new category mappings based on interaction term significance.

This method identifies significant differences between the thermosensitivity of each category and provides new mappings that merge similar categories. Categories are grouped based on the significance of interaction terms in the model, which helps reduce complexity while retaining meaningful distinctions.

Parameters:

significant_level (float, optional) – The significance level for the Wald test (a p-value below this level is considered significant). Must be between 0 and 1. The higher the value, the more categories will be kept separate. Lower values will merge categories that are not significantly different.

Returns:

dict – A dictionary mapping old categories to new merged categories. The new labels are concatenated with a “-” separator to indicate merged groups.

Notes

  • The new categories are based on the result of multiple Wald tests conducted between interaction terms for each category.

  • The returned dictionary allows for updating the category labels to reflect merged groupings that exhibit similar behavior.

Example

>>> auto = AutoCategoricalThermoSensitivity(...)
>>> auto.fit()
>>> auto.new_categories(significant_level=0.1)
{'Monday': 'Monday-Wednesday-Sunday',
 'Tuesday': 'Tuesday',
 'Wednesday': 'Monday-Wednesday-Sunday',
 'Thursday': 'Thursday',
 'Friday': 'Friday',
 'Saturday': 'Monday-Wednesday-Sunday',
 'Sunday': 'Sunday'
}
class energy_analysis_toolbox.thermosensitivity.daily_analysis.DailyCategoricalThermoSensitivity(energy_data: Series, temperature_data: Series, categories_func: Callable[[DatetimeIndex], Series], degree_days_type: Literal['heating', 'cooling', 'both', 'auto'] = 'heating', degree_days_base_temperature: dict | None = None, degree_days_computation_method: Literal['min_max', 'mean', 'integral', 'pro'] = 'integral', interseason_mean_temperature: float = 20, base_logger_name: str | None = None, min_logger_level_stdout: int | str = 40)[source]#

Bases: CategoricalThermoSensitivity

Class for daily analysis of thermosensitivity data.

Based on CategoricalThermoSensitivity, it is made to categorize the days.

Example:#

See DayOfWeekCategoricalThermoSensitivity

class energy_analysis_toolbox.thermosensitivity.daily_analysis.DayOfWeekCategoricalThermoSensitivity(energy_data: Series, temperature_data: Series, degree_days_type: Literal['heating', 'cooling', 'both', 'auto'] = 'heating', degree_days_base_temperature: dict | None = None, degree_days_computation_method: Literal['min_max', 'mean', 'integral', 'pro'] = 'integral', interseason_mean_temperature: float = 20, base_logger_name: str | None = None, min_logger_level_stdout: int | str = 40)[source]#

Bases: DailyCategoricalThermoSensitivity

Models independently the 7 days of the week.

Based on DailyCategoricalThermoSensitivity.