Skip to content

Forecast

cli_analysis(args)

detect_fever_hypothermia(df, baseline, data_column='y', pred_column='y_hat', residual_column='residual', date_column='ds', date_fmt='%Y-%m-%d %H:%M:%S')

Main function to detect fever and hypothermia thresholds.

This function orchestrates the process of calculating baseline residual bounds, hourly statistics, and fever/hypothermia thresholds.

PARAMETER DESCRIPTION
df

The input DataFrame.

TYPE: DataFrame

baseline

The number of hours to use as baseline.

TYPE: float | int

pred_column

The name of the column with predicted values.

TYPE: str DEFAULT: 'y_hat'

residual_column

The name of the residuals column.

TYPE: str DEFAULT: 'residual'

date_column

The name of the date column.

TYPE: str DEFAULT: 'ds'

date_fmt

The date format string.

TYPE: str DEFAULT: '%Y-%m-%d %H:%M:%S'

RETURNS DESCRIPTION
DataFrame

A DataFrame with hourly statistics and fever/hypothermia thresholds.

tuple[float, float]

Lower and upper residual bounds, respectively.

run_analysis(df, baseline, data_column='y', pred_column='y_hat', residual_column='residual', date_column='ds', date_fmt='%Y-%m-%d %H:%M:%S')

Compute statistics from the DataFrame and hourly stats, and return them as a dictionary.

PARAMETER DESCRIPTION
df

The original DataFrame with all data.

TYPE: DataFrame

baseline

The number of hours to use as baseline.

TYPE: float | int

data_column

Column name with observed data.

TYPE: str DEFAULT: 'y'

pred_column

The name of the column with predicted values.

TYPE: str DEFAULT: 'y_hat'

residual_column

The name of the residuals column.

TYPE: str DEFAULT: 'residual'

date_column

The name of the date column.

TYPE: str DEFAULT: 'ds'

date_fmt

The date format string.

TYPE: str DEFAULT: '%Y-%m-%d %H:%M:%S'

RETURNS DESCRIPTION
dict[str, Any]

A dictionary containing the computed statistics.

The returned dictionary is an analysis from several key areas.

Explanation of outputs

duration

Provides statistics for the entire duration of the dataset.

total_hours: Time between the earliest and latest data point.

max_temp: Maximum observed temperature in dataset.

min_temp: Minimum observed temperature in dataset.

baseline

Provides statistics of the period of time before a vaccine challenge. This establishes data that is used to fit the forecasting model with.

degrees_of_freedom: Number of data points considered to be in the baseline.

average_temp: Mean temperature during the baseline.

std_dev_temp: Standard deviation during the baseline.

max_temp: Maximum temperature observed during the baseline.

min_temp: Minimum temperature observed during the baseline.

residual_sum_squares: Computes the sum of squares of the specified residual column.

residual

TODO:

fever

Provides statistics related to elevated temperatures.

duration: Maximum observed temperature in dataset.