PREDICT Class¶
- class PREDICT.PREDICT(data, model, dateCol='date', startDate='min', endDate='max', timestep='month', recalPeriod=None, verbose=False)¶
A class used to represent the PREDICT model.
- Parameters:
data (pd.DataFrame) – The data to be used by the model.
model (PREDICTModel) – The model to be used for prediction.
dateCol (str)
startDate (str, dt.datetime) – The start date for the prediction window.
endDate (str, pd.datetime) – The end date for the prediction window.
timestep (str, int) – The timestep for the prediction window. Must be ‘week’, ‘day’, ‘month’, or an integer representing the number of days. Defaults to ‘month’.
currentWindowStart (pd.datetime) – The current start date of the prediction window.
currentWindowEnd (pd.datetime) – The current end date of the prediction window.
log (dict) – A dictionary to store logs.
logHooks (list) – A list of hooks to be called during logging.
recalPeriod (int) – An integer giving the number of days for the recalibration window. Defaults to ‘timestep’.
verbose (bool) – Print sample size calculation warnings.
- addLog(key, date, val)¶
Adds a log entry to the log dictionary.
- Parameters:
key (str) – The key for the log entry.
date (any) – The date for the log entry.
val (any) – The value for the log entry.
- addLogHook(hook)¶
Adds a hook to the logHooks list.
- Parameters:
hook (function) – A function to be called during logging.
- getLog()¶
Returns the log dictionary.
- Returns:
The log dictionary.
- Return type:
dict
- run()¶
Runs the prediction model over the specified date range.