Saving $300K Annually: Machine Learning for Predictive Maintenance in Cannabis Production

I built AI models to predict machine failures at Decibel Cannabis Co, achieving a 96.8% accuracy, and potentially saving $300 000 annually by enabling proactive maintenance rather than emergency repairs.
Tyson Sze
Fusion Collegiate
Grade 10

Problem

Manufacturing machine failures cause unexpected production stoppages, which results in emergency repairs, missed deadlines, and significant costs. At Decibel Cannabis Company’s facility, unplanned downtime happens in around 32% of production shifts, averaging 39 minutes per event. 

Current maintenance practices are reactive - meaning that equipment is repaired only after a failure occurs. This approach is expensive and disruptive.

The cannabis industry faces unique pressures: strict regulatory requirements, high-value products that require minimal waste, and a competitive market demanding a constant supply. Traditional preventive maintenance still allows unexpected failures between intervals.

Research Question: Which machine learning algorithm - Random Forest, XGBoost, LightGBM - most accurately predicts unplanned downtime?

If machine failures could be predicted before they happen, Decibel could schedule their maintenance more proactively, reducing emergency repair costs, minimizing production disruptions, and improving overall equipment reliability. This research will test whether machine learning can provide an advance warning of downtime with enough accuracy for operational decision-making.

Method

Data Source:  Analyzed 2 281 production shifts from Decibel’s two main pre-roll manufacturing machines from January to September 2025. Data included production volumes, quality metrics, downtime records, and maintenance logs.

Feature Engineering: Created 27 predictive features across 5 categories:

  1. Efficiency metrics: OEE, availability, performance, quality
  2. Temporal features: day of week, month, shift type
  3. Lag features: previous shift performance
  4. Rolling statistics: 3-shift moving average of downtime and quality
  5. Production metrics: operating time, output, defects

Target variable: Unplanned downtime (breakdown time that excludes scheduled maintenance or breaks). Classification: binary (>15 minutes is significant downtime). Regression: continuous (downtime duration in minutes).

Models Tested:

  1. Random Forest: Ensemble of 100 individual decision trees with bootstrap aggregation.
  2. XGBoost: Gradient boosting with sequential error correction.
  3. LightGBM: Optimized gradient boosting using histogram-based learning.

Training:

  • Train-test split: 80% training, 20% testing
  • Stratified sampling to maintain a class balance
  • Hyperparameters: Conservative settings to prevent overfitting.

All research performed in Python using scikit-learn, XGBoost, and LightGBM libraries.

Research

Literature Review: Predictive maintenance has proven to be successful across manufacturing sectors, with some accuracy rates of 70-95%, and cost reductions of 25-30% (McKinsey, 2024). Random Forest and gradient boosting methods are state-of-the-art for tabular data prediction.

However, no published research uses machine learning for cannabis manufacturing machine reliability. The cannabis industry’s rapid industrialization creates an opportunity for data-driven optimization.

Hypothesis: Gradient boosting methods such as XGBoost and LightGBM will outperform Random Forest due to their sequential error correction and their ability to capture complex, non-linear patterns.  Specifically predicted: (1) gradient boosting will achieve >90% accuracy on classification, (2) gradient boosting will achieve <10 minutes of regression error, (3) all models will agree on top predictive features.

Prior Art: Feature engineering approaches were based on established predictive maintenance literature: lag features capture persistence, rolling averages identify trends, OEE numbers quantify machine health. The 3-shift rolling average was selected based on expert consultation indicating that degradation typically occurs over 24-36 hour periods. 

Data

Data Collection: Production logs were provided by Decibel Cannabis Company (proprietary data used with permission). Automated system records were captured at the end of each shift. 

Dataset Characteristics:

  • Total records: 2 281 shifts
  • Time period: 9 months (January - September 2025)
  • Machines: 2 pre-roll lines (Preroll-ER2, Preroll-ER3)
  • Coverage: Both day and night shifts, all days of week

Raw Variables: Production: planned time, operating time, total quantity, good quantity, scrap quantity, total quantity Maintenance: breakdown time (minutes), maintenance time (minutes) Quality: defect counts, rejection causes Temporal: date, shift type, machine

Preprocessing:

  • Feature engineering reduced the usable dataset to 154 samples
  • No imputation needed - complete cases only

Data Quality Issues:

  • Small final sample after creating rolling features
  • Short time window may miss seasonal patterns
  • No sensor data (vibration, temperature) available

All data handled according to confidentiality agreement with Decibel. Production volumes and financial details remain proprietary.

Conclusion

Results: Classification: LightGBM achieved 96.8% accuracy with perfect recall, catching every breakdown. Random Forest: 90.3%, XGBoost: 87.1%.

Regression: Random Forest achieved lowest average error with a MAE of 7.8 minutes. XGBoost: 11 minutes MAE, LightGBM: 13.6 minutes MAE.

Feature Importance: All three models agreed that the rolling 3-shift downtime average was the most important predictor, indicating that equipment degradation follows a pattern.

Hypothesis Evaluation: Partially supported. Gradient boosting (LightGBM) was the best classifier as predicted, but Random Forest unexpectedly won regression. This shows that on small datasets, simpler ensemble methods are able to generalize better than complex sequential optimizers, which can overfit. 

Practical Impact: Deployed at Decibel, this system could:

  • Reduce unplanned downtime frequency by 30-50%
  • Lower emergency repair costs by 50% by proactive maintenance
  • Save $150 000 - $300 000 annually per machine
  • Enable maintenance team to intervene before a catastrophic failure

The 7.8 minute prediction accuracy also allows for realistic production planning and resource allocation.

Limitations: Small sample size (154) means that 96.8% accuracy is likely optimistic - real world performance is expected to be at 80-90%. The short time period (9 months) misses seasonal patterns. Results are also specific to Decibel’s machines and operations, generalization will require validation. 

Future Work: Expand the dataset to 500+ samples, add sensor data (temperature, vibration), implement time-series cross validation, pilot deployment to measure actual savings.

Significance: Demonstrates that even smaller manufacturers can use machine learning for operational optimization using standard production logs.

Citations

1. Scikit-learn Development Team (2025). "scikit-learn: Machine Learning in Python." https://scikit-learn.org/ 2. Chen\, T.\, & Guestrin\, C. (2016). "XGBoost: A Scalable Tree Boosting System." Proceedings of KDD '16. 3. Ke\, G.\, et al. (2017). "LightGBM: A Highly Efficient Gradient Boosting Decision Tree." NIPS 2017. 4. McKinsey & Company (2024). "Predictive Maintenance: The Next Frontier in Industrial IoT." 5. McKinney\, W. (2010). "Data Structures for Statistical Computing in Python." Proceedings of the 9th Python in Science Conference. 6. Hunter\, J. D. (2007). "Matplotlib: A 2D Graphics Environment." Computing in Science & Engineering, 9(3), 90-95. 7. Decibel Cannabis Company (2025). Production data logs and operational documentation. Proprietary data used with permission.

Acknowledgement

Special thanks to Decibel Cannabis Company for providing production data and operational insights that made this project possible.

Thanks to Mr. Kevin Zeng for guidance on model design and statistical methodology.

Gratitude to family members for support throughout the project and research process.