InnovationAnalysis
Machine learning at a biogas plant: production forecasting and early warning - what works and what is a promise
Machine learning can forecast biogas production and detect anomalies, but it needs good data. An overview of tasks, methods, pitfalls and measures of usefulness.
Other language versions: Polski, Deutsch, Español, Français, Italiano, Nederlands.

Biogas plants produce large amounts of data: flows, temperatures, pH, gas composition, power draw. The temptation arises to harness machine learning (ML) for them. These methods can forecast well and pick up deviations, but their usefulness depends on data quality more than on the choice of algorithm. Below we separate what is practical from what is a promise.
Tasks for which ML is used
- Forecasting biogas or methane production over a horizon of hours, days or weeks — useful for planning cogeneration operation, energy sales or biomethane injection.
- Anomaly detection — recognising situations that depart from the typical behaviour of the process before alarm thresholds are exceeded.
- Process state classification — distinguishing stable operation, overload or the onset of acidification.
- Inference of unmeasured quantities (so-called soft sensors), e.g. estimating VFA or FOS/TAC from continuous data, which can reduce the number of analyses.
Methods in brief
- Linear and regularised regression — simple, transparent, good as a baseline; often surprisingly hard to beat.
- Random forests and gradient boosting — cope with nonlinearities and missing data, and work well on tabular data.
- Recurrent networks (LSTM) and other sequence models — take the process history into account, but require a lot of data and care.
- Hybrid models — combine a physical model (e.g. simplified ADM1, see ADM1 and the digital twin) with a part learned from data that corrects deviations. With a limited amount of data they often give better and more reliable results than pure ML.
Data requirements
The basis is the length and diversity of the history: a model trained over half a year of operation on a single mix will not predict the behaviour of the installation after a change of substrates. Data are needed from periods of different loads, seasons and substrate batches. Frequency is also important — for a daily forecast hourly averages are enough, while for anomaly detection minute data are often needed. Laboratory data (dry matter, organic dry matter, VFA) are in turn valuable as labels, but usually sparse. Data cleaning is necessary: removing erroneous values, aligning timestamps, marking downtime and sensor calibrations.
Pitfalls
- Overfitting. The model reproduces the past brilliantly, but fails on new data. The solution is validation on a period unseen in training, with a time-based split (not a random one).
- Sensor drift. A shift in readings over time will be read by the model as a change in the process.
- Change of mix. A model trained on one substrate structure loses accuracy after a change; it requires retraining or a physical component.
- Lack of failure labels. Acidification and other events are rare, so classification models have too few examples. Hence the greater popularity of anomaly detection than of classification.
- Correlation instead of cause. A model may link production to a factor that merely co-occurs, and fail when the interdependence disappears.
How to measure usefulness
The R² value alone is not enough. Practically useful are:
- forecast error (e.g. mean absolute error, MAE) in production units, compared with a simple reference model, e.g. "tomorrow the same as today",
- warning lead time — how many hours before the event the model sent a signal,
- the number of false alarms per week; too many cause the operators to stop reacting to them,
- the share of detected events from the history, checked retrospectively.
The result is worth translating into decisions: whether the warning would give the operator a chance to act and whether they have the ability to respond.
The operator's role
A model will not replace the operating staff. The operator knows context that the data do not see: a change of silage supplier, a pump failure, a frost forecast. A well-implemented system presents a warning with its justification (which variables acted) and leaves the decision to a human. It is also worth establishing who is responsible for maintaining the model after implementation.
Data and contracts with the service provider
With cloud solutions, pay attention to: ownership of data and results, the right to export, anonymisation rules, the location of processing, the security of the connection to controllers (separation of the automation network), service availability and how the installation operates when the service stops working. A control system should not depend on the cloud for safety matters.
A realistic assessment
ML can bring benefit if the installation has reliable instrumentation, a history and a person responsible for the data. Without this it is just another promise. We do not give expected gains, because they depend on the installation, and guarantees of effects should result from contractual provisions and a pilot. The rules of such verification are described in the guide How to assess a new technology, and the baseline instrumentation in the article on monitoring and automation.





