@logistics-ts/classification
v0.1.1
Published
ABC, XYZ, FSN, ABC-XYZ matrix, and demand-pattern (SBC) classification for logistics-ts.
Readme
@logistics-ts/classification
Inventory and demand classification for logistics-ts:
ABC (value), XYZ (variability), FSN (movement), the ABC-XYZ policy matrix, and
the Syntetos–Boylan–Croston demand-pattern classifier that drives forecasting
method selection. Every classifier returns an Explained<T> result.
Install
npm i @logistics-ts/classificationWhat's in it
abc— Pareto value classification (the "vital few").xyz— demand-variability classification from a bucketed series.fsn— fast / slow / non-moving split.abcXyzMatrix— combines ABC + XYZ into a policy-hinted cell per item.classifyDemandPattern— smooth / erratic / intermittent / lumpy (Syntetos–Boylan–Croston quadrant); this is what@logistics-ts/forecasting'sautoForecastroutes on.
Quick start
import { bucketize, generateExampleData } from '@logistics-ts/core'
import { abc, abcXyzMatrix, xyz } from '@logistics-ts/classification'
const { demand } = generateExampleData({ items: 6, seed: 2 })
const series = bucketize(demand, 'month')
const items = series.map((s) => ({
itemId: s.itemId,
volume: s.buckets.reduce((sum, b) => sum + b.quantity, 0),
unitValue: demand.find((d) => d.itemId === s.itemId)?.unitPrice ?? 0,
}))
const abcResult = abc(items, { by: 'value' })
const xyzResult = xyz(series)
const matrix = abcXyzMatrix(abcResult.value, xyzResult.value)
console.log(matrix.value) // [{ itemId, class: 'AX'..'CZ', policyHint }, ...]In the umbrella package
@logistics-ts/classification is re-exported as the classification
namespace from logistics-ts.
It depends only on @logistics-ts/core.
