6 * forcb structure contains generic forecasting fields. The individual
7 * forecastres can see the current time series and time_stamps as well
8 * as any other local state that wish to preserve.
16 fbuff series; /* data series */
17 fbuff time_stamps; /* time stamp series */
18 fbuff se_series; /* cumulative sq. err. series */
19 fbuff ae_series; /* cumulative ab err series */
20 double best_f; /* best forecast */
21 int best_i; /* best forecast number */
22 double best_err; /* cum best err */
33 typedef struct forcb_stc *forcb;
35 #define FORCB_SIZE (sizeof(struct forcb_stc))
39 * list of forcb structs -- used as a cookie through the interface
53 #define FORCL_SIZE (sizeof(struct fork_list_stc))
55 typedef struct fork_list_stc *forcl;
65 #define FORCLIFE_SIZE (sizeof(struct forc_life_stc))
67 typedef struct forc_life_stc *forclife;
71 * initializes forecasting structure with as many as #max_forc_count#
72 * forecasters and a circular buffer with #buff_size# values and
73 * time_stamp entries. Returns a cookie to be passed subsequently
76 InitForcl(int max_forc_count, int buff_size);
82 InitForcLife(int max_forc_count, int buff_size, double lifetime);
85 * frees forecaster state associated with cookie #i_forcl#
88 FreeForcl(char *cookie);
94 FreeForcLife(char *state);
98 * updates forecaster state associated with #cookie# using #value#
99 * and #time_stamp#. Neither #value# nore #time_stamp# are checked
103 UpdateForecasts(char *cookie, double time_stamp, double value);
109 UpdateForcLife(char *state, double ts, double value);
112 * returns value and lifetime from series (may be averages)
115 LifetimeValue(char *state);
118 LifetimeTimestamp(char *state);
123 * generates MSE nd MAE forecasts value for data associated with #cookie#
125 double MSEForecast(char *cookie);
126 double MSEOptForecast(char *cookie);
127 double MSEError(char *cookie);
128 int MSEMethod(char *cookie);
129 int MSEOptMethod(char *cookie);
130 double MAEForecast(char *cookie);
131 double MAEOptForecast(char *cookie);
132 double MAEError(char *cookie);
133 int MAEMethod(char *cookie);
134 int MAEOptMethod(char *cookie);
137 * same API for versions that take a lifetime and forecast the average
139 double MSELifetimeForecast(char *cookie);
140 double MSELifetimeError(char *cookie);
141 int MSELifetimeMethod(char *cookie);
142 double MSELifetimeEpoch(char *cookie);
143 double MAELifetimeForecast(char *cookie);
144 double MAELifetimeError(char *cookie);
145 int MAELifetimeMethod(char *cookie);
146 double MAELifetimeEpoch(char *cookie);
149 * prints the low and high forecasts and their forecast numbers
152 ForcRange(char *cookie, double *low, double *high, int *low_i, int *high_i);
155 * prints a summary of forecaster state
157 void PrintForecastSummary(char *state);
158 void PrintLifetimeForecastSummary(char *state);
161 * routine put in to support FORECASTAPI_MethodName which doesn't
162 * take a state record
164 void GetForcNames(char *state,
170 * generic interface requiring no size parameterization -- could waste
175 * maximum number of forecasters
177 #define MAX_FORC (35)
180 * default size of circular buffer
182 #define MAX_DATA_ENTRIES (100)
184 #define INITFORECASTER() (InitForcl(MAX_FORC,MAX_DATA_ENTRIES))
185 #define FREEFORECASTER(cookie) (FreeForcl(cookie))
186 #define UPDATEFORECASTER(cookie,ts,v) (UpdateForecasts((cookie),(ts),(v)))
187 #define FORECAST(cookie) (MSEForecast((cookie)))
189 #define DBIG_VAL (999999999999999999999999999.99)
190 #define FORE_ERROR_VAL (DBIG_VAL)