Forecasting
Understanding and predicting customer demand allows retailers to plan effectively for peak seasons, promotions, and other events. This helps in optimizing resource allocation, such as staffing and marketing efforts, to meet customer expectations.
Accurate ans systematic forecasting helps retailers determine the right amount of inventory to keep in stock. Overstocking can lead to increased holding costs, markdowns, and potential losses, while understocking can result in lost sales and dissatisfied customers.
You should keep some common factors and best practices in mind. Here are some important considerations:
Check that your data is correct and free of errors. Before using the data for forecasting, check for and repair any inaccuracies.
Look for outliers or extreme values in your data. Outliers can throw predictions off, so it's critical to identify and handle them carefully.
Check that the data you have is consistent throughout time. For example, if you're tracking sales, ensure sure your measurement method remains consistent. Also keep in ming that working with sales units only makes sense if the items in the bucket are comparable.
Understand why something large changed in your data, such as a sudden surge or reduction in sales. These changes are not always permanent and should not be used to forecast future trends.
Prediction engine can handle various scenarios at ease. It is designed to handle outliers and seasonality in most cases. For accurate forecasts it is recommended to have two years worth data at minimum. The quality can also be significantly improved by adding events such as:
promotions
inventory levels
weather observation
Generating predictions will generally be slower than simpler functions. Therefore it is recommended to have fewer items in the live report. For larger number of items it is recommended to use batch processing and writeback. With batch processing it is also guaranteed that the prediction for the same item will not change over time allowing more in-depth analysis of the forecast.
Forecast can be added to any report so that further calculations can take advantage of predicted values using the following function:
Fn.forecast(values, dates, weeks)
At minimum the formula takes two arguments:
list of values
list of corresponding dates or weeks
The lists can be easily constructed by using StringConcat aggregation on time and value fields.
The function returns list of tuples where each tuple holds the following values:
date or week
forecasted value
upper uncertainty bound
lower uncertainty bound
date of Monday if the forecast has been constructed using weeks
historical fact value if the history option was passed to the function
Each tuple in the list represents single forecasted value at given date.
Full list of arguments:
values: List[float] - list of observed historical values, each value must correspond to a single date or week.
dates: List[str|datelike] | None - list of observation dates, each date must correspond to single value.
weeks: List[str|datelike] | None - list of observation dates, each date must correspond to single value; if weeks are passed the prediction engine automatically uses weekly granularity automatically; weeks must be week strings in 'YYYY-00-MM' format.
Optional arguments:
start: str|datelike - if set then the list of observations is extended with empty values up to given date; this is recommended to ensure observations include missing data points.
end: str|datelike - if set then the list of observations is extended with empty values up to given date; this is recommended to ensure observations include missing data points.
freq: str - 'D' or 'W'; forecast granularity; when dates are used the granularity defaults to day.
length: int - number of forecasted data points.
cap: bool - if True then prediction prevents unlimited growth; in most cases this is recommended to prevent forecast grow beyond the business capacity; the capacity itself is automatically determined based on the observed historical values; if not set then global configuration value is used.
country: str - if set to 2-letter ISO country code the predictor automatically adds holiday effect for given country; if not specified then global configuration value is used.
history: int - if set to value greater than 0 then historical observations are added to the returned values; this is useful for visualization purposes.
suppress_error: str - if message is provided then the prediction engine returns it instead of failing; most common failure is not having enough data points for prediction.
Configuration options
Country code - 2-letter ISO country code. If set and no value was passed to the prediction function the holidays will be determined using this value. If no country code has been set the prediction will not include holiday effect.
Growth cap - If enabled then prediction will limit the forecast grow beyond the throughput capacity.