  Insect outbreaks are biotic disturbances in forests and agroecosystems that
cause economic and ecological damage. This phenomenon depends on a variety of
biological and physical factors. The complexity and practical importance of the
issue have made the problem of predicting outbreaks a focus of recent research.
Here, we propose the Pattern-Based Prediction (PBP) method for predicting
population outbreaks. It is based on the Alert Zone Procedure, combined with
elements from machine learning. It uses information on previous time series
values that precede an outbreak event as predictors of future outbreaks, which
can be useful when monitoring pest species. We illustrate the methodology using
simulated datasets and real time series data obtained by monitoring aphids in
wheat crops in Southern Brazil. We obtained an average test accuracy of
$84.6\%$ in the simulation studies implemented with stochastic models, and
$95.0\%$ for predicting outbreaks using the real dataset. This shows the
feasibility of the PBP method in predicting outbreaks in population dynamics.
We benchmarked our results against established state-of-the-art machine
learning methods, namely Support Vector Machines, Deep Neural Networks, Long
Short Term Memory and Random Forests. The PBP method yielded a competitive
performance, associated with higher true-positive rates in most comparisons,
while being able to provide interpretability rather than being a black-box
method. This is an improvement over current state-of-the-art machine learning
tools, especially when being used by non-specialists, such as ecologists aiming
to use a quantitative approach for pest monitoring. We provide open-source code
to implement the PBP method in Python, through the \texttt{pypbp} package,
which may be directly downloaded from the Python Package Index server or
accessed through \url{https://pypbp-documentation.readthedocs.io}
