The rationale behind EWSNet stems from the rapid success and widespread adoption of machine learning algorithms and their ability for learning patterns from data (Humphries et al. 2018). EWSNet exploits this ability by training models upon the simple non-linear mathematical models pioneered by ecological dynamic system research (Ludwig et al. 1978, Fraedrich 1978, Cheng et al. 2008, Scheffer et al. 2012, Kéfi et al. 2013). Specifically, these models encompass four forms of transition/tipping point - saddle-node (fold), pitchfork, supercritical Hopf, transcritical (Figure 3a) – and include non-transitions to allow EWSNet to identify periods of stability. This combination of training results in three possible EWSNet predictions: critical transition, smooth transition or no transition. To aid interpretation of these predictions in real world systems, we suggest that a critical transition indicates oncoming sudden non-linearity, a smooth transition indicates a directional change in trend, and no transition indicates stability as outlined in Figure 3b.
With machine learning tools limited for R users, and EWSNet written in the Python language, the reticulate R package (Ushey et al. 2022) allows EWSmethods to call the Python functions required to load EWSNet and make predictions from user data. EWSmethods prepares the user’s R session to perform this interfacing via the ewsnet_init function. ewsnet_init loads a previously created Python environment with the Python packages required by EWSNet, or installs Python and initialises a new environment if either Python or the environment is not found. Due to the large file sizes being downloaded at this stage, ewsnet_init is verbose by default and requires user input to confirm that Python, the required packages, and environment should be downloaded and/or installed.
Users can then use ewsnet_predict to generate EWSNet predictions on a time series of interest. To date, EWSNet only supports only univariate time series, however the multivariate form of EWSNet is under active development. The current version of EWSNet also differs to that of the original authors by being robust to time series of variable length. This involved retraining using randomly sampled subsets of the data, ranging in length from 15 to 400 data points to better support the shorter time series available to empirical ecologists. Similarly, due to the variable magnitudes of ecological measurements, two sets of EWSNet’s training weights are provided in EWSmethods , scaled vs unscaled (ewsnet_reset is required to download them); scaled models rescale the input data into the range 1-2. We recommend using scaled weights as they result in more reliable model predictions following comparison (O’Brien et al, in prep). ewsnet_predict then returns a prediction probability for each of the three potential outcomes ranging from 0.0 – 1.0. As EWSNet was trained on three possible outcomes, a probability of ~0.33 indicates all prediction outcomes are equally likely (1.0 divided by 3 equals ~0.33). Therefore, its authors suggest any probability greater than 0.33 implies a stronger than chance prediction and anything greater than 0.6 warrants serious scrutiny (Deb et al. 2022).