预测间歇需求与补货库存
依据历史需求识别稀疏销售模式,输出交期需求预测、补货水位及可复现的回测代码。
完整提示词
<context>
Items that sell in most periods can be forecast with ordinary methods. Spare parts, slow movers and B2B items often sell nothing most weeks and then a few, or a lot, at once. Ordinary methods fail on them: exponential smoothing chases each spike, percentage errors are undefined when actuals are zero, and a forecast of "0.3 a week" is useless for deciding stock. Practitioners classify each item by the average interval between demands (ADI) and the squared coefficient of variation of non-zero demand sizes (CV²), using the Syntetos-Boylan cut-offs of 1.32 and 0.49 to label it smooth, erratic, intermittent or lumpy. Croston's method forecasts demand size and interval separately; the SBA correction removes its known upward bias; TSB updates the probability of demand every period, so it handles items going obsolete. For stocking, what matters is the distribution of total demand over the lead time, which a bootstrap of past demand can estimate directly. Accuracy is judged on scaled errors and on the service level actually achieved, not MAPE.
Tool: {{tool}}
{{#lead_time_and_service}}Lead time and service: {{lead_time_and_service}}{{/lead_time_and_service}}
</context>
<task>
<history>
{{demand_history}}
</history>
1. Check the data: confirm zeros are recorded, flag zeros that might be stock-outs, and note items with too few demand occurrences to estimate anything (fewer than about five non-zero periods).
2. Classify each item by ADI and CV² with the calculation shown, and give its class.
3. Choose a method per class: smooth items can use ordinary methods; intermittent and lumpy items use SBA or TSB (TSB if demand is declining or the item may be phased out); very sparse items use a bootstrap of lead-time demand or a simple rule. Say why.
4. Produce the per-period forecast and, more importantly, the lead-time demand distribution: mean, and the quantile matching the service level.
5. Stocking implication: reorder point or order-up-to level from that quantile, and the stock cost it implies. Flag items where the cost of holding stock outweighs the service level target and a make-to-order or supplier-stock option is worth discussing.
6. Write {{tool}} code that reproduces the classification, the forecast and a backtest using scaled error (MASE or similar) and achieved fill rate. Python: statsforecast (CrostonSBA, TSB, ADIDA) with pandas. R: tsintermittent or fable extensions. Spreadsheet: ADI and CV² formulas and a simple Croston with SBA factor, saying what is lost.
7. Caveats: obsolescence, changes in installed base, and why the forecast should be reviewed with the people who know upcoming maintenance or projects.
</task>
<constraints>
- Never use MAPE on intermittent series.
- Compute only from the data supplied; label hand calculations as approximate and tell the user to confirm by running the code.
- Do not present a fractional per-period forecast as the answer for stocking; translate it into lead-time demand and a stock level.
- If lead time or service level is missing, show the method with stated example values and ask for the real ones.
{{> output/uncertainty}}
</constraints>
<output_format>
## Summary
Per item: class, method, stocking level, in one table or a few lines.
## Demand pattern
Table: item | non-zero periods | ADI | CV² | class.
## Method choice
Bullets with reasons.
## Forecast and lead-time demand
Table: item | per-period forecast | lead-time demand mean | service-level quantile.
## Stocking implication
Table: item | reorder point | stock value | note.
## Code
One code block in {{tool}}.
## Caveats
Bullets.
</output_format>可替换内容
- {{tool}}
- {{#lead_time_and_service}}
- {{lead_time_and_service}}
- {{/lead_time_and_service}}
- {{demand_history}}
- {{> output/uncertainty}}
分类与标签
商业营销、间歇需求、备件库存、补货计划、需求预测、预测回测