Skip to content
BI, AI and ML for the business

Demand and stock forecasting

Sales history and stock levels are already in the ERP. Your data scientist builds a forecasting model with scikit-learn; Muvia runs it every night next to the data and puts forecast, actual sales and understock in front of the people who reorder.

Illustrative scenario: it describes a typical case, not a customer project.

Sales from the ERP, stock from the warehouse database, the promotions plan and distributor sell-out flow into Muvia, where a model built by the team computes forecasts; out come a forecast table, a forecast versus actual dashboard, an understock alarm and a reorder report.

The forecast often exists already. It lives on someone's laptop.

In many companies an analyst has already built a model that forecasts demand by item. It runs by hand, on an ERP export, when there is time; the numbers end up in a file that purchasing may or may not open.

Muvia does not sell a ready-made forecast: the model stays your team's, with your features and your choices. Muvia runs it on a schedule against governed data and brings the result to where reorders are decided.

Who it's for
Data scientists and analysts who build the model; purchasing, supply chain and warehouse teams who use its forecasts.

What you get

The model stays yours
The team decides the algorithm, the features and when to retrain. Muvia does not replace the data scientist: it gives the model a place where it actually runs.
Forecast next to actual
The dashboard shows where and when the model misses, so you know when it is time to revisit it.
Understock seen earlier
The alarm starts from forecast cover, not from an empty shelf, and stays in the alarm register with whoever handles it.
A run you can check
Every night the same function version runs on the same governed data; a new model is a new version, tried before it goes live.

For the technical team

How it is built in Muvia

  1. 1

    Bring sales and stock into Muvia

    The ERP and the warehouse database become sources copied every night, incrementally and over an encrypted connection. Promotions and sell-out arrive as files; every source becomes a table you can query.

  2. 2

    Prepare features in SQL

    In the SQL editor, compute weekly sales by item and warehouse, moving averages, the same week last year and active promotions. The result is a dataset with stable fields: the contract between the data and the model.

  3. 3

    Build the model

    The data scientist trains a scikit-learn model in their own environment, on data pulled through the read-only API, and attaches it as a joblib file to a Python function. Alternatively, the function can refit a scikit-learn estimator on every run, on the window of history it receives.

  4. 4

    Run forecasts every night

    A scheduled flow hands the features to the function and writes forecasts into a managed table. Try it first in trial mode, which writes nothing; then recompute history to see how it would have forecast past weeks.

  5. 5

    Compare and alert

    A dashboard puts forecast and actual sales on the same chart, by item and warehouse. An alarm opens when forecast cover falls below the threshold, and the reorder report goes out every Monday.

Python function

import joblib

FEATURES = ["sold_last_week", "moving_avg_4", "same_week_last_year",
            "promo_active", "week_of_year"]

def transform(inputs, params, ctx):
    model = joblib.load(ctx.file("demand.joblib"))
    df = inputs["rows"]
    out = df[["item", "warehouse", "week", "on_hand"]].copy()
    out["forecast_qty"] = model.predict(df[FEATURES]).clip(min=0)
    forecast = out["forecast_qty"].where(out["forecast_qty"] > 0)
    out["weeks_of_cover"] = out["on_hand"] / forecast
    out["understock"] = out["weeks_of_cover"] < params["min_weeks_of_cover"]
    ctx.logger.info("forecasts computed: %d rows", len(out))
    return {"rows": out}
The model your team trained travels with the function version: Muvia loads it and writes forecasts into the managed table.
The data it needs
  • Orders and sales lines by item and customer, from the ERP on SQL Server
  • Stock on hand and safety stock by warehouse, from the warehouse's Oracle database
  • Promotions plan, from an Excel file uploaded each month
  • Weekly distributor sell-out, CSV files received over SFTP
Parts of Muvia used

Bring us a question you can't answer today.

We start from a real question your business has and walk the path from source to dashboard with your systems, not a demo dataset.