The company rated every item as a winner, regular or loser — internally AAA, A and B. The rating was done by hand: each analyst reviewed items one by one, weighing sales and rotation per store together with their own knowledge of colors and current best sellers. It was slow, inconsistent between analysts, and impossible to scale, so the company asked me to automate it.
Understanding the data
I started by pulling together everything analysts used to make the decision. The data was far from clean, with many missing values to fill. Once it was usable, a second problem appeared: raw sales were not a fair signal, because store sizes vary enormously. An item selling well in a small store looked like a poor performer next to a large one. I switched to rotation per store as the core metric, which normalizes performance regardless of store size.
With the dataset organized I compared several candidate models:
- Logistic Regression
- Random Forest
- Gradient Boosting
- K-Means
Choosing K-Means — and three categories instead of five
I used a test set to compare the models against each other and against the current manual ratings, which also let me check whether the analysts' decisions were consistent. K-Means came out on top.
The elbow method, however, showed that the natural number of clusters was three, not the five categories the company had used for years. That led to a conversation about inventory management and sales strategy: the business agreed to restructure its item categories around what the data actually supported.
Fixing the accuracy
The first trained model performed poorly. Digging into the data, I found two causes: each product category has its own average sales and rotation, so the model had to be trained per category; and franchise stores lacked enough data to classify reliably and were blinding the model, so they were filtered out.
With those changes the model reached 85% accuracy and the company adopted it to classify its items. They also asked for a dashboard to explore the results, which I built in Power BI.