05

One harvester burned 3,144 liters more than its neighbors. The data knew in May.

AgricultureAnalytics

A sugarcane mill logs a great deal: hectares cut per hour per operator, liters of diesel per refuelling, RPM, event codes for every stop, tons entering the gate. None of it is organized to answer the question a fleet manager actually asks at the end of the month: who, and which machine, is consistently worse than the others doing the same job on the same ground?

At a glance
Client
Ipiranga Agroindustrial - sugarcane group, four mills
Industry
Agriculture · Sugar & ethanol
Problem
Low-performing operators and machines were only found after the season closed, if at all
Solution
Two complementary detectors: a statistical field-by-field ranking that flags chronic underperformers, and a Random Forest "expected performance" model that flags every entry outside the model's error margin
Stack
Operational yield + event logs (2023–2024) · refuelling records (2023–2025) · mill intake (2021–2025) · scikit-learn RandomForestRegressor · statistical thresholding · monthly alert reports
Delivered as
MVP report, April 2025
The challenge

A sugarcane mill logs a great deal: hectares cut per hour per operator, liters of diesel per refuelling, RPM, event codes for every stop, tons entering the gate. None of it is organized to answer the question a fleet manager actually asks at the end of the month: who, and which machine, is consistently worse than the others doing the same job on the same ground?

The naive answer (rank everyone by ha/h) is wrong. Yield depends on the field, the crop, the day, the process. A good operator on a bad field looks worse than a bad operator on a good field. The comparison has to be controlled.

Sample of the operational yield table with daily per-operator metrics.
Fig. 01. Operational yield records, 2023–2024: one row per operator per day, with ha/h, fuel, RPM, and process codes.
Sample of the refuelling table with hour-meter, distance, diesel and hydraulic oil.
Fig. 02. Refuelling records, 2023–2025: hour meter, distance, diesel liters, hydraulic oil liters.
Sample of the mill intake table with cane weights.
Fig. 03. Mill intake, 2021–2025: tons of cane received per truck. The ground truth for what the field actually produced.
What they needed
  • A monthly list of operators and machines performing below what the same field would predict
  • Enough statistical backing that a supervisor could take it into a conversation
  • The same method for people and for equipment
  • A worked economic case on at least one flagged machine
Goals & success metrics
  • Two performance indicators tracked: operational yield (ha/h) and fuel consumption (L/h)
  • Alerts issued per operator, per equipment, per month
  • Model error low enough that "outside the margin" means something (achieved: R² 0.97, SMAPE 3.9%)
  • A quantified savings case on a real flagged machine
How we did it
  1. 01

    Look at the statistics before the AI

    Before any model, the data was profiled to decide where to spend effort. Initial decisions: focus on cane cutting, focus on the CH 570, and run two approaches side by side.

    Bar chart of the most frequent processes in the event logs.
    Fig. 04. Cane cutting dwarfs every other process in the logs. Focus there first.
    Bar chart of mean and standard deviation of yield per process.
    Fig. 05. Yield per process. The standard deviation on cane cutting is large: that spread is the improvement room.
    Bar chart of fuel consumption per process with error bars.
    Fig. 06. Fuel per process. Same story: cutting is both the highest consumer and the most variable.
    Bar chart of machinery frequency, dominated by one harvester model.
    Fig. 07. One harvester model, the CH 570, is by far the most common. Start with a homogeneous fleet.
    Bar chart of how often each field appears in the logs.
    Fig. 08. No field dominates. Filtering by field would not simplify anything, so fields become a control variable instead.
    Yield per machinery model with error bars.
    Fig. 09. Yield per machine model.
    Fuel per machinery model with error bars.
    Fig. 10. Fuel per machine model. Both spreads are wide enough to justify an operator-level look.
  2. 02

    Approach 1 - statistical ranking within the same field

    For each field, period, and farm, agents (operators or machines) are ranked by yield or by fuel. The method counts how often each agent was the worst of its ranking, then tests whether that count is above what chance would produce. If it is, an alert is issued.

    Three small ranking tables showing how one agent ends up worst in multiple fields.
    Fig. 11. The method in miniature: across three fields, C is last once and A is last twice. The test decides whether twice is too many.
    Horizontal bar chart of how often each equipment was worst, with the expected threshold line and one bar flagged red.
    Fig. 12. Equipment 3014053 was the worst of its ranking in 16 of 24 fields. The threshold line is the maximum a machine can be last without triggering an alert; this one clears it easily.
    Bar chart of operators below expected yield for June 2023, two flagged.
    Fig. 13. June 2023, one farm: two operators flagged below expected yield.
    Bar chart of operators below expected yield for July 2023, one flagged again.
    Fig. 14. July 2023, same farm: one of them is flagged again. Persistence is what makes the alert actionable.
  3. 03

    The worked example: equipment 3014053

    The same machine was flagged for fuel consumption above expected in three consecutive months. If 3014053 had matched the average consumption of its peers over those three months, it would have burned roughly 3,144 liters less. At R$ 6.00/L that is ~R$ 18,864 for one machine, one quarter. Extrapolated to a 240-day harvest: ~R$ 50,304. The detector would have caught it in May.

    Fuel ranking chart for May 2024 with equipment 3014053 flagged.
    Fig. 15. May 2024: consumption alert.
    Fuel ranking chart for June 2024 with the same equipment flagged.
    Fig. 16. June 2024: still flagged.
    Fuel ranking chart for July 2024 with the same equipment flagged.
    Fig. 17. July 2024: third month in a row.
    Bar charts comparing fuel per hour and hours worked for 3014053 versus equipment in the same fields.
    Fig. 18. Against machines that worked the same fields: 3014053 consumed more per hour and was also used for more hours, which compounds the loss.
    Line chart of daily average fuel for 3014053 versus peers by month.
    Fig. 19. Daily average consumption. The gap to peers opens in May and widens in July.
    Ranked bar chart of hours of use per equipment in Iacanga, May–July 2024.
    Fig. 20. Fourth most-used machine in Iacanga over the period. A problem on a busy machine is worth more than a problem on a parked one.
  4. 04

    Approach 2 - predicted performance with AI

    The second detector inverts the question. Instead of ranking, it learns what performance should have been for every entry (given field, process, machine, day, and the rest) while hiding the operator, then compares actual to predicted. Entries outside the model's error margin are the anomalies; agents that are repeatedly outside it are the alerts. Next steps identified: tighter models shrink the margin and expose more opportunities; explainability methods show why an entry was flagged; and the expected-versus-realized pattern generalizes to any operation with a log.

    Code snippet of a scikit-learn RandomForestRegressor.
    Fig. 21. A RandomForestRegressor. Boring on purpose: it handles mixed categorical and numeric inputs and is easy to explain.
    Predicted versus actual scatter plots for 2023 and 2024 with metrics.
    Fig. 22. Model performance: MSE 0.0007, SMAPE 3.91%, R² 0.9715. The margin of error is tight enough that a miss is informative.
    Scatter of expected versus actual fuel consumption per entry.
    Fig. 23. Fuel: predicted versus realized. Points above the band are entries that spent more than the field explains.
    Scatter of expected versus actual yield per entry.
    Fig. 24. Yield: predicted versus realized. Points below the band are entries that produced less than the field explains.
    Bar chart of the share of each operator's entries with fuel above the error margin.
    Fig. 25. Per operator: share of entries with fuel outside the margin. Some operators overspend in up to 13% of their entries.
    Bar chart of the share of each operator's entries with yield below the error margin.
    Fig. 26. Per operator: share of entries with yield below the margin, up to 6%.
    Bar chart of the share of each equipment's entries with fuel above the margin.
    Fig. 27. Same method, same model, applied to equipment: overspend in up to 9% of entries.
    Bar chart of the share of each equipment's entries with yield below the margin.
    Fig. 28. Equipment yield below margin, up to 5%.
    Bar chart of the share of below-prediction entries per operator, full list.
    Fig. 29. The full operator list from the first iteration of the model.
    Bar chart of the top operators by share of below-prediction entries.
    Fig. 30. The short list. This is what the supervisor gets.
What did not work: predictive maintenance

The client also asked for maintenance prediction. We tried, and the honest result is that the data was not there yet.

The reason is structural: none of the available signals describe what sends a machine to the workshop. Engine temperature, engine hours and idle hours, lubricant consumption, and similar telemetry would. That is the instrumentation gap, and naming it is more useful to the client than a model that pretends.

Scatter of average RPM over time for one machine with maintenance events marked.
Fig. 31. RPM over time for one machine, maintenance dates marked. Very few positive events, and nothing in RPM that announces them.
Daily aggregation table combining yield, fuel and RPM statistics per equipment.
Fig. 32. Features: operational yield, fuel, RPM and refuelling, aggregated per day and per equipment (mean, median, max, min).
Grid diagram of a sliding time window predicting a future maintenance flag.
Fig. 33. Framed as a time series: a past window (blue) predicts a maintenance flag in the future (red).
Training loss curve.
Fig. 34. Multiclass and binary classification (with class weights and a WeightedRandomSampler to fight the imbalance): the model learns very little.
Confusion matrix of the binary maintenance classifier.
Fig. 35. The confusion matrix says what the loss curve implied.
Diagram of one-class classification: model the normal class, flag what does not fit.
Fig. 36. One-class classification, modelling only "no maintenance" and flagging outliers, was the last attempt. Also inconclusive.
FAQ

Still have a question?

Ask us directly. A person reads it and gets back to you quickly.

Contact us