Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Evaluating Forecast Accuracy | Inventory Management and Demand Forecasting
Practice
Projects
Quizzes & Challenges
Quizer
Challenges
/
Python for Supply Chain

bookEvaluating Forecast Accuracy

Sveip for å vise menyen

Understanding how well your demand forecasts match reality is critical in supply chain management. Two of the most widely used forecast error metrics are Mean Absolute Error (MAE) and Mean Squared Error (MSE). These metrics help you quantify the difference between your predicted demand and what actually occurred, providing a clear way to assess and compare forecasting methods. MAE measures the average magnitude of errors in a set of forecasts, without considering their direction, while MSE gives more weight to larger errors by squaring the differences.

123456789101112131415
def mean_absolute_error(actual, forecast): """ Calculate Mean Absolute Error (MAE) between two lists. """ n = len(actual) absolute_errors = [abs(a - f) for a, f in zip(actual, forecast)] return sum(absolute_errors) / n def mean_squared_error(actual, forecast): """ Calculate Mean Squared Error (MSE) between two lists. """ n = len(actual) squared_errors = [(a - f) ** 2 for a, f in zip(actual, forecast)] return sum(squared_errors) / n
copy

When you use these error metrics, lower values generally indicate that your forecast is closer to the actual demand. MAE is straightforward to interpret: it tells you, on average, how many units your forecast is off by. MSE, because it squares each error, penalizes larger mistakes more heavily. This means that if your forecast sometimes makes large errors, the MSE will be noticeably higher than the MAE. Both metrics are useful for comparing different forecasting models or methods, but you should be aware that MSE is more sensitive to outliers due to the squaring of errors. By applying the functions above, you can directly compute these error metrics for any pair of actual and forecasted demand lists.

12345678
actual_demand = [100, 120, 130, 115, 140] forecasted_demand = [110, 125, 128, 120, 135] mae = mean_absolute_error(actual_demand, forecasted_demand) mse = mean_squared_error(actual_demand, forecasted_demand) print("Mean Absolute Error (MAE):", mae) print("Mean Squared Error (MSE):", mse)
copy

1. Why is it important to evaluate forecast accuracy in supply chain management?

2. What does a high MAE indicate about a forecast?

3. Fill in the blank: The formula for MAE is the mean of the absolute ____ between actual and forecasted values.

question mark

Why is it important to evaluate forecast accuracy in supply chain management?

Select all correct answers

question mark

What does a high MAE indicate about a forecast?

Select the correct answer

question-icon

Fill in the blank: The formula for MAE is the mean of the absolute ____ between actual and forecasted values.

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 2. Kapittel 4

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

Seksjon 2. Kapittel 4
some-alt