What each model does, without formulas.

StockAI does not use one model: it uses several and lets them compete product by product. This chapter explains the idea behind each one and the type of product it is used for.

Why several models

No model is the best for everything. One that understands seasons is overkill for a product that sells evenly; one that learns from lots of data gets confused by a new product. Rather than picking one blindly, several are tested with the rule from chapter 2, and for each product the one that costs least is kept.

The classics: they look only at past sales

  • ETS (exponential smoothing): an average that gives more weight to recent values and gradually "forgets" the old ones. It can follow a trend and a season. Simple and hard to fool.
  • ARIMA: describes each value as a mix of the previous values and the previous errors. Good for series that move with momentum.
  • SARIMAX: ARIMA with seasonality.
  • Prophet: splits the series into trend, seasons and special days, and adds them up. Designed for sales with a strong seasonality and holidays.

The machine-learning models: they learn rules from the data

  • LightGBM and XGBoost: build hundreds of small decision trees ("if yesterday sold more than 30 and it is a Friday, then..."), each one correcting the errors of the previous one. They are fed with what sold 1, 7 and 14 days ago, averages of the last 1, 2 and 4 weeks, and the calendar: day of the week, month, national holidays, Holy Week, Christmas.
  • LSTM: a small neural network that reads the last two weeks of sales and learns the shape of the curve. It needs at least 30 points of history.
  • Global model: a single LightGBM trained on all your products at once. Each product is scaled to its own size, so it learns shared patterns (the fortnight effect, for example) and is most useful for products with little history, which lean on the rest of the catalog.

The sporadic-sales models

Croston (with the SBA correction) and TSB are built for products that sell nothing on many days. Chapter 4 explains them with a simulator.

Which model competes for which product

The label from chapter 1 decides who competes. A product can have several labels, and then the models for all of them compete:

  • Short: only simple forecasts (repeat the last value or the last week). With so little history, anything more complex would invent patterns.
  • Intermittent: Croston and ETS.
  • Seasonal: Prophet, ETS, LightGBM, SARIMAX and LSTM.
  • Stable: LightGBM, XGBoost, ARIMA, SARIMAX and LSTM.
  • Volatile: LightGBM, XGBoost, Prophet, ARIMA, ETS and SARIMAX.

You choose the menu

The classification only narrows the list of models you turned on: it never trains one you did not choose. If no model is left for a product, all the models you turned on compete. And the global model, if you turn it on, always runs.

What you take away

  • The classics (ETS, ARIMA, Prophet) look only at the past of each product.
  • LightGBM, XGBoost and LSTM learn rules using recent sales and the calendar.
  • The global model learns from your whole catalog and helps products with little history.
  • The label of each product decides which models compete, among the ones you turned on.

Where you see it in StockAI

When you set up a training run, you choose which models to turn on. In the results, each product shows which one won and its error, and you can see the comparison among those that competed.

Put your own AI to work forecasting your sales. Today.

Three ways to start, depending on how much you want to commit right now. All three lead to the same product.

Create your account

With the whole engine. Upload your sales file and see your first forecast, and with it your first list of what to order.

Create my account

Look before giving your email

An instant trial account with sample data. It lasts 24 hours and is then erased.

Try it without signing up

Talk to us

For the corporate plan, the source code, or to see it with your data and someone beside you. We answer within 24 hours.

Sales and contact: contacto@stockai.es. Phone: +506 7186 2820.

Sales forecasting made in Costa Rica, for companies across Latin America.