Machine Learning in management of precautionary closures caused by lipophilic biotoxins

Mussel farming is one of the most important aquaculture industries. The main risk to mussel farming is harmful algal blooms (HABs), which pose a risk to human consumption. In Galicia, the Spanish main producer of cultivated mussels, the opening and closing of the production areas is controlled by a monitoring program. In addition to the closures resulting from the presence of toxicity exceeding the legal threshold, in the absence of a confirmatory sampling and the existence of risk factors, precautionary closures may be applied. These decisions are made by experts without the support or formalisation of the experience on which they are based. Therefore, this work proposes a predictive model capable of supporting the application of precautionary closures. Achieving sensitivity, accuracy and kappa index values of 97.34%, 91.83% and 0.75 respectively, the kNN algorithm has provided the best results. This allows the creation of a system capable of helping in complex situations where forecast errors are more common.


Introduction
Global mussel production has steadily increased to 2.2 million tonnes in 2018, more than double the amount produced ten years ago ( [1]).Nearly 94% of global mussel production comes from aquaculture ( [2]).Young mussels are harvested from the sea and may be grown on suspended ropes; these ropes, which are covered with mussel seed held in place with nylon nets, are suspended either from rafts, or wooden frames, or from longlines with floating plastic buoys.A substantial portion of EU production is farmed on suspended ropes, a technique that can be extended further offshore and which, although very sensitive to plankton blooms, is the only one that could allow further increases in production.
One of the main risks of mussel farming is Harmful Algal Blooms (HABs).HABs are episodes of high concentrations of algae, including some cyanobacteria and microalgae that are potentially toxic for human consumption.This is because there is a risk of poisoning by consuming filter-feeding bivalve molluscs such as mussels that feed on these algae, accumulating the toxins in their meat.To monitor these episodes, there are programs set up in mussel production areas.For the early detection of high toxicity events, these monitoring programmes have fixed sampling points strategically located in the production areas.These high toxicity events can lead to a temporary suspension of mussel harvesting and marketing.The most common toxin-producing species are those of Diarrhoeic Shellfish Poisoning (DSP) type.The most abundant of which is the dinoflagellate Dinophysis acuminata) ( [3]).
The opening and closing of the production areas is based on the analysis of the toxicity of the mollusc meat, as established by European legislation ([4]).Within the monitoring programme, sampling planning uses expert knowledge based on information on endogenous and exogenous factors influencing the proliferation of potentially toxic phytoplankton species.The most compromising point of this process is the absence of sampling during non-working days or when inclement weather does not allow it to be carried out.This leads to situations where it is impossible to collect the data to support an effective closure.If there are indications of a potential increase in toxicity levels, the competent authority is legally entitled to proceed with 'precautionary closures' of bivalve mollusc production areas.
Precautionary closures may become effective after a subsequent analysis verifying the presence of toxins, otherwise, the closure will be lifted.The application or non-application of these measures creates two possible problem scenarios.In the first scenario the precautionary closure is applied even though toxicity values above the legal threshold are not reached.This scenario could lead to economic losses for producers because they are prohibited from working while the area remains closed.In the second scenario no indications of a high toxicity event are detected, but a subsequent analysis shows the presence of toxins.The latter is a much more dangerous situation than the previous one because, during this period of extraction activity, there is a potential risk of introducing contaminated shellfish into the market, with the consequent risk to public health.
Today, the implementation of precautionary closures is based on the experience of monitoring experts.The existence of a predictive model could help them make the right decisions in complex situations.
Harmful algal blooms are not only a potential risk to public health, they are also a major problem for the production sector.Work such as that of Di Jin and Porter Hoagland ( [5]) has shown that the development of predictive systems can lead to significant improvements in management strategy and profits for the farming sector.So far, numerous studies have attempted such predictions around the world, notably off the coasts of South Korea ( [6]), Hong Kong ( [7]) and the Persian Gulf ( [8]), in general, these works have focused their efforts on predicting biomarkers such as the concentration of toxic phytoplankton in the water or chlorophyll-a ( [9,10]).There are studies for the specific case of the Spanish coast ( [11]) and specifically for the Galician coast ( [12,13,14]).For the creation of this type of predictive models, the use of different classical techniques has been compared with ML techniques to try to find the co-figuration that best suits this problem ( [15,10]).
It was determined that ML techniques outperform classical methods.The success of applying machine learning techniques to harmful algal blooms lies in the selection of the relevant data and the pre-processing of the data.The proliferation of harmful algal blooms is influenced by many factors, the most important of which are: temperature, water flow, upwelling, light, nutrients and salinity.
A higher water temperature favours algae proliferation, as well as thermocline stratification favours their concentration ( [16]).Excessive water flow and circulation disperses algae concentrations, reducing the occurrence of blooms ( [17]).The light is necessary for phytoplankton to photosynthesise ( [18]).Dissolved nutrients in the water create a favourable environment for algal growth ( [18]).The salinity plays an important role in the formation of phytoplankton communities ( [19]).
The best results were obtained using the combined CNN and LSTM spatio-temporal classification technique to classify and discriminate between HAB and non-HAB events produced in Florida coastal waters by the algae Karenia brevis ([20]).But it is difficult to have such a large volume of data on a regular basis, and even impossible for many regions.Therefore, we have studied the effect of sample size ( [21]) and modelling with feature reduction ( [22]).
As mentioned above, chlorophyll-a concentration is one of the most recurrent biomarkers of potentially toxic phytoplankton proliferation ( [22]).Chlorophyll-a is related to the concentration of phytoplankton containing this pigment, but not only biotoxin-producing phytoplankton contain it.Therefore, this biomarker may be in error when algal blooms are of non-harmful algae.On the other hand, if the objective is to close mussel production areas as a result of exceeding the legal threshold for the presence of biotoxins ( [14]), this could lead to a significant improvement in the accuracy of the prediction.
For this reason, the objective of this study is the creation of a predictive model of high toxicity events in mussel production areas.Consequently, the classification of mussel production areas will focus on whether the presence of lipophilic toxin in mussel flesh exceeds the legal threshold or not.To do this, a comparison of solutions will be carried out, applying different machine learning techniques to predict the state of production areas affected by DSP-type toxins.Taking into account previous studies carried out in the field ( [15]), a total of 6 classification techniques were selected: Artificial Neural Network (ANN), Support Vector Machines (SVMs), k-Nearest Neighbour (kNN), XGBoost, Random Forest and Naïve Bayes.This model can be used by government agencies with responsibilities in the control of shellfish production areas and its use can be of benefit to the mussel industry and the consumer.A workflow of the proposed system can be seen in figure 1.The structure of this paper is defined as follows: It starts with a section on advances in the field of HAB prediction, and in particular in the use of ML techniques for this purpose.In section 2 the techniques used as well as the configuration of the techniques used are presented.The results of these models can be found in section 3 and will be interpreted in section 4. Finally, in sections 5 and 6 the conclusions obtained and the lines of future work are presented.

Dataset and its construction
The production status (open/closed) of the crop areas has been used as the target variable.This status of crop areas is assigned according to whether or not the presence of toxin in the mussel tissue exceeds the legal threshold.If the threshold is exceeded, extraction activities in that crop area will cease (closure of the crop area) or, if not, extraction activity will be allowed (opening of the crop area).It was decided to focus the study on predicting the state of the cultivation areas each Monday.This is because no toxin presence analysis is carried out on the previous days (Saturday and Sunday), which is one of the most compromised points of the existing monitoring system.Twelve out of thirteen mussel production areas of the Vigo estuary (Galician coast, Spain) have been selected: Cangas F, Cangas G, Cangas H, Cangas C, Cangas D, Cangas E, Vigo A, Redondela A, Redondela B, Redondela C, Redondela D and Redondela E (see figure 2), excluding from this study the production area of Baiona A because it is a polygon that remains unsampled for long periods of time.As the areas are managed independently, and as input variables, we have used a set of environmental and oceanographic data of different nature, recorded by different institutions between 2004 and 2018.The network of sampling points for phytoplankton monitoring coincides, to a large extent, with the stations set up to determine oceanographic conditions, figure 2. Weekly, an oceanographic vessel takes samples from points V1, V2, V3, V4, V5, V6 and V7, located in the Vigo estuary.Their distribution can be seen in the figure 3).In each sampling point, integrated samples of water between 0 and 15 metres deep to count phytoplankton cells and determine nutrients dissolved in water, were taken.Simultaneously, a multiparametric probe measures the physico-chemical parameters of the water column.The different variables collected in these oceanographic stations, as well as other constant variables for the whole estuary obtained thanks to METEOGALICIA ([23]) and the IEO ( [24]), are shown in the table 1.All oceanographic stations have been taken into account in order to know which ones offer the data most related to the occurrence and concentration of HAB, as this depends directly on the functioning of factors such as the morphological configuration of the estuary itself or sea currents.By analysing the data collected, it is determined that the sampling frequency of the data collected is mainly weekly, so this metric will be used as a reference for the creation of the models.The pre-processing of the input data was as follows: • The weekly information on chlorophyll-a is collected in three samples divided by depth bands: mean chlorophyll-a between 0 and 5 metres, between 5 and 10 metres and between 10 and 15 metres.Since the presence of toxicity in mussel from any part of the culture rope means the total closure of the production area, the maximum value between the three depths was chosen.

Source
• The count of Dynophysis acuminata is a single, weekly value, so information from all available stations was used.
• Nutrient data are collected on a weekly basis and there is only a single piece of data per station, so the count from each oceanographic station was used.
• Environmental values, such as temperature and oxygen, were averaged to unify the information into a single measurement since the data are originally irregular measurements at depths between 0 and 25 metres.Only values up to 12 metres were used for averaging, as this is the length of the mussel ropes.
In addition, with the temperature and salinity values, a differential was made between the mean of the first 6 metres and that of the following 6 metres, in order to be able to detect the presence of stratifications, both thermoclines and haloclines.
• The sun data, such as hours of incidence, insolation and irradiation, come from the Meteogalicia weather station, so the data are daily and common for the whole estuary.In order to simplify the input parameters, the weekly average of each of the parameters was calculated.• The upwelling index data are calculated on a daily basis over four time periods: 00:00 hours, 06:00 hours, 12:00 hours and 18:00 hours.In order to simplify the data, the weekly average value was used, thus estimating the predominant value throughout the week.
• To simplify the seasonality into a single value, the date of sampling was transformed, using only the number of the week of the year.
• The specific value of toxins in mussel flesh is a value for which no regular records are covering the whole casuistry in a robust way.Instead, it was concluded that it was possible to classify the status of production areas according to whether the growing area was closed or not.These closures are applied in case the level of toxicity in the mussel flesh exceeds the legal threshold.This information could be obtained by analysing INTECMAR's historical record of closures ( [25]).
The processing of the 15 years' data resulted in an input dataset of 783 samples.Each of the samples consists of 76 input features.For a more detailed analysis of the input parameters, see table 2.
This dataset had incomplete samples with missing data for some of the features, so it was necessary to eliminate those rows with such inconsistencies in their data.These samples with missing values were referred to as null samples.After this filtering, a resulting dataset of 175 samples was left.The distribution in the labelling of the samples can be seen in the table 3.As can be seen in this table, toxicity episodes are more .Table 2: Descriptive analysis of input features common in the crop areas located in the outer part of the estuary, while their frequency decreases towards the inner parts of the estuary.Figure 4 shows the behaviour of the HABs that occurred in 2016.An input dataset was created for each of the twelve crop zones; these matrices share 75 of the 76 input features, with the exception of the Friday opening or closing status of the zone to be estimated.

Machine Learning Models
Based on previous literature, a total of 6 machine learning techniques have been considered: Artificial Neural Networks, Support Vector Machines, XGBoost, k-Nearest Neighbor, Random Forest and Naïve Bayes.These  .techniques will be tested in order to check which method is the most suitable for the approach proposed in this study.These well-known techniques will be briefly presented below.

Artificial Neural Networks
Artificial neural networks (ANNs) are massively parallel interconnected networks of simple (usually adaptive) elements and hierarchical organisation.Artificial neural networks are part of a data analysis technique that, compared to their more rigid and complicated alternatives, offers greater flexibility in processing large volumes of multivariate, non-linear data ([26]).

Vector Support Machines
The classification-regression method Support Vector Machines (SVM) was first proposed by Cortes and Vapnik in 1995 ( [27]), within the field of computer science.The machine conceptually implements the idea that input vectors are mapped non-linearly into a very high-dimensional feature space.A linear decision surface is constructed in this feature space.The special properties of the decision surface guarantee a high generalisation ability of the learning machine.

XGBoost
XGBoost or Extreme Gradient Boosting is an extensible, state-of-the-art application of gradient boosting machines and has been shown to overcome the limits of the computational power of Boosted tree algorithms.
Boosting is an ensemble technique in which new models are added to correct errors in existing models.Models are added recursively until no noticeable improvement is found.Gradient boosting is an algorithm in which new models are created to predict the residuals of previous models and then added together to produce a final prediction.It uses a gradient descent algorithm to minimise losses when adding new models ( [28]).

k-Nearest Neighbour
The

Random Forest
Random Forest is an ensemble method, which builds many decision trees that will be used to rank a new instance based on the majority vote.Each node of the decision tree uses a subset of features randomly selected from the original set of features.In addition, each tree uses a different bootstrap data sample, in the same way as bagging.Bagging methods are almost always more accurate than single classifiers.On the other hand, boosting methods can be more accurate than bagging methods but are very sensitive to noise.
Random Forest is more robust to noise than boosting methods; performs as well as boosting and sometimes better; and does not overfit ( [30]).

Naïve Bayes
Today, the Naïve Bayes classifier is used in many applications due to its simple but powerful principle of ( [31]) accuracy.Bayes' theorem finds the probability of an event occurring given the probability that another event has already occurred.However, this classifier does not take into account the number of occurrences, which is a potentially useful source of additional information.They are called "naïve" because the algorithm assumes that all terms occur independently of each other.

Performance mesuares
For the analysis of the trained models and their subsequent comparison, 6 statistics were taken into account that were considered relevant when assessing the results (average accuracy, average sensitivity, average kappa coefficient, minimum accuracy, minimum sensitivity and minimum kappa coefficient).In the confusion matrix used to calculate the statistics, closures were defined as positive and openings as negative.Thus, True Positives (T P ) correspond to those closures correctly classified as closures, True Negatives (T N ) identify openings classified as such, False Positives (F P ) represent those openings wrongly classified as closures and, finally, False Negatives (F N ) are those closures that have been classified as openings.
Calculated according to Eq. 1 accuracy estimates how correctly a binary classification test identifies or excludes a condition.As this is a binary classification paper, this parameter is considered relevant.

T P + T N T P +
Not performing a closure when the toxin is present in the mussel poses a higher risk, prioritising the human factor over the economic one.Sensitivity (Eq.2) prioritises avoiding misclassifying closures as openings.
Sensitivity was therefore the benchmark statistic in this study.

T P T P + F N
( Cohen's kappa coefficient, calculated according to Eq. 3, is a statistical measure that adjusts for the effect of chance on the proportion of observed agreement between two experts.In this equation, P r(a) represents the relative observed agreement between the observers, while P r(e) is the hypothetical probability of agreement by chance.In this study, the model outputs were compared with the labelling performed by the experts to analyse the effect of chance on the models.
The criteria taken into account when selecting the best models were the values explained above (accuracy, sensitivity and kappa coefficient), as well as the number of features used to make the prediction.A smaller number of input variables would make it easier to make predictions, even on days when certain data are missing.Sensitivity is the most important factor to be taken into account due to the absolute priority of minimising false negatives (as they pose a risk to public health).

Experimentation setup
By using the strategy of K-folds strategy, specifically 10-fold, yields 10 values of each statistic.The K-fold cross-validation procedure randomly divides a dataset into k disjoint blocks of approximately equal size, and each block is in turn used to test the model induced from the other k − 1 blocks by a classification algorithm.
The performance of the classification algorithm is evaluated by the average of the k-precisions resulting from the cross-validation of k-blocks.This method avoids choosing models with good averages but which perform poorly on certain training blocks, thus ensuring the robustness of the models.The minimum values of the statistics explained above are also taken into account.
Significance analysis was deemed necessary to ensure the robustness of the classification.First, a normality analysis was performed, to ensure that a parametric test can be performed ( [32]).When the sample size is at most 50, normality can be tested with the Shapiro-Wilk test test.The Anderson-Darling statistic measures how well the data follow a specific distribution.For a particular data set and distribution, the better the distribution fits the data, the lower this statistic will be.Both the Shapiro-Wilk test and the Anderson-Darling test showed that the sensitivity data for all areas are normal.ANOVA analysis allows multiple means to be compared by studying variances.This was followed by pairwise comparison, in the specific case of this project, with the Tukey-Kramer test.The significance was estimated according to Copenhaver-Holland ( [33]).
For this study two sets of features were used: one with all 76 input features and another one where the most redundant features were filtered out.In order to do this, a correlation analysis was carried out between the features, and those with a correlation of more than 90% between them were eliminated.This was an empirical approach in which preliminary tests were carried out to eliminate only those variables that really had a very close relationship and leave it to a more purely objective process such as a ranking system to use or assign importance to each.Through this process, influential factors have been sought in less common variables.In this second approach, the 76 input features were reduced to 50.
Then, in each approach, starting from the raw data, a feature selection process was conducted.This has several advantages.Firstly, we make our model easier to interpret.Secondly, we can reduce the variance of the model and thus the overfitting.Finally, we can reduce the computational cost (and time) of training a model.To carry out the feature selection process, the features were ordered using a ranking process.Two ranking techniques were used for this process: • Applying a filtering method such as correlation with the variable to be forecast.Using the statistical value to rank order the features, three sets of tests were proposed: one with 25% of the best ranking features, one with 50% and the last one with 75%.
• Use of an embedded method such as the Random Forest algorithm.The tree-based strategies used by Random Forest are naturally ranked according to how they improve node purity.This means a decrease in impurity over all trees (called Gini impurity).Nodes with the highest decrease in impurity occur at the beginning of the trees, while notes with the lowest decrease in impurity occur at the end of the trees.Thus, by pruning the trees below a particular node, we can create a subset of the most important features.After applying this ranking, three sets of tests were proposed: one with 25% of the best ranking features, one with 50% and the last one with 75%.
Different experiments have been defined based on the application of one, both or none of the ranking methods mentioned above.To ensure the reliability of the results, the tests were carried out with a cross-validation strategy of 10-fold.In order to determine the configuration of the best performing models, a grid search was performed and the parameter values of the models used in the training were adjusted as shown in the table 4.

Results
During the feature selection process, the combined Pearson Correlation and Random Forest techniques were applied.Thanks to this, it was possible to extract the importance that these methods give to the features for the classification process.Figure 5 shows a summary of the behaviour of these methods throughout the production zones, reflecting the percentage of persistence of each variable after the selection processes.It can be seen that the state of the production zone in the week before the prediction day is the most important characteristic, followed by the concentration of D. accuminata and the concentration of dissolved nutrients such as nitrate and nitrite.For each of the production zones, a more detailed overview of the feature selection process can be found in tables 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 and 18.These tables show how the data collected at each oceanographic station have a different effect on nearby areas.This is due to how marine currents affect the estuary and how certain stations gain importance over others concerning each production area.
. Figure 5: Summary table with the occurrence of the features after the feature selection processes.Where each point represents the likelihood of a variable being selected as an input feature for a particular production area.
By applying each of the 6 machine learning techniques to the 12 production zones independently, it has been possible to observe the comparative solutions offered by each of these methodologies.In figure 6 the values of sensitivity, accuracy and kappa obtained by the best models trained with each algorithm and for each production zone can be seen.Algorithms such as kNN or NB obtain more stable results for all the zones, while algorithms such as SVM, RF and XG, although they show certain stability in the values of accuracy, show great variability in the sensitivity values depending on the production zone.The ANN algorithm is presented as the algorithm with the greatest variability in its results.
For a detailed analysis of how the algorithms behave in each of the production zones, please refer to the figures 7 and 8.In these graphs it can be seen that the models perform better in the production areas of Cangas F, Cangas G, Cangas H and Redondela A. While the areas where the models have more difficulties in making predictions are: Redondela B, Redondela C and Redondela D.  The models defined as the best in each of the production zones during the first approach are shown on table 5 and those of the second approach on table 6.These tables show the sensitivity, accuracy and kappa values.
When applying the ten-folds strategy, it is necessary to show the results as the tuple of mean value and standard deviation of the values obtained in each fold.

Discussion
The study of the predictor variables for ML models in the prediction of HAB episodes has been one of the most critical points raised in the literature.To date, there is still no consensus on which are the most influential features, varying considerably depending on the geographical region where it is applied and the ML techniques studied.Chlorophyll-a concentration is one of the most relevant features [9,7], as it is directly .Figure 7: Combination of recall, accuracy and kappa in the production zones for each algorithm.The average values for each metric across all folds are shown.In each case, the best performing configurations are represented.1/2 related to phytoplankton abundance, but in this study, it has been clearly surpassed by the concentration of D. accuminata.This is due to the fact that this marker is more accurate when estimating the lipophilic toxin, this dinoflagellate being one of its main producers.It is also necessary to highlight the importance of nutrients such as nitrate and nitrite [7] and environmental factors such as temperature and salinity [34].
The results offered by the kNN machine learning algorithm have been the best for the problem analysed in this work, which is the creation of a predictive model of high toxicity events in mussel production areas (reaching mean sensitivity, mean accuracy and mean kappa index values of 97.34%, 91.83% and 0.75 respectively).Its best values of sensitivity, accuracy and kappa have been higher than those obtained with Random forest, ANN, SVM, Naïve Bayes and XGBoost techniques (see figure 6).It should be noted that the average kappa value obtained (0.75) has a substantial degree of agreement according to the scale of values proposed by .These results reflect the imbalance present in the input data which, in areas such as Redondela C, reach a

Conclusions
Although the work carried out to date has obtained good results in predicting biomarkers of FAN, the control of the state of the production areas is conditioned by other external factors, which means that the definition of the problem changes.Some work has used real-time prediction of shellfish and fish mortality events as HAB markers ( [34]).But real-time prediction does not provide reaction time to these events.However, in this study we have achieved 3-day predictions while maintaining good results.For this we have used the presence of a toxin level above the risk threshold as a HAB marker.In the Galician coast, some previous works seek to solve this problem ( [14]), achieving sensitivity and accuracy values of 67.4% and 83% in the production area of "Vigo A" by applying the ANN technique, while in the present work a significant improvement in the results has been achieved.
The approach of the study has shown that it is possible to estimate the status of production areas affected by marine biotoxin events using machine learning techniques.For this purpose, an extensive historical record of variables related to the occurrence of episodes of high toxicity in mussels has been used.The estimates obtained with the models studied have achieved high values of sensitivity and accuracy, so that the expectations initially set out in this study have been met.It has been found that the machine learning algorithm that offers the best results for the resolution of this specific problem in all the production areas of the estuary is the kNN technique.Its best sensitivity and accuracy values have been superior to those obtained with the techniques of Random forest, ANN, SVM, Naïve Bayes and XGBoost.
The models developed during the study can be used to assess the robustness of the decisions taken by experts when managing the opening or closure of production areas in the absence of recent sampling.This dual assessment mechanism can help experts in complex situations where forecast errors are more likely.

Future Works
In this work, 6 different machine learning algorithms were studied to solve the problem.It is proposed to compare the results obtained with other alternative algorithms that can approach the problem from another perspective, such as hybrid machine learning algorithms ( [36]).
The study has focused only on the Vigo estuary, as it is one of the most important Galician estuaries for the production of mussels, and because of its geomorphological characteristics that give it a behaviour in the distribution and evolution of algal blooms of great scientific interest.However, the study is continuing with the aim of supporting the rest of the Galician estuaries with mussel production.
In this study, variables identified as relevant in the state of the art have been selected.However, other new variables (e.g.wind, currents, other toxic phytoplankton species, etc.) could be considered as input parameters in the training of machine learning algorithms.
One of the limiting factors in conducting this study has been the amount of missing data from the time series used as data sets.It is therefore considered that the creation of a system capable of obtaining or generating (synthetic data ( [37])) such data could lead to a significant improvement in the results obtained. .

Figure 1 :
Figure 1: Schematic representation of the machine learning-based system for predicting harmful algal bloom closures and aiding decision making in mussel farming.This graphic has been designed with resources from Flaticon.com

Figure 4 :
Figure 4: Distribution of closure episodes caused by HAB in mussel production areas in the Vigo Estuary (2016).Source: http://www.intecmar.gal/Informacion/biotoxinas/Evolucion/DiagramaBateas.aspx k-Nearest Neighbor (kNN) classifier is an unsupervised machine learning technique for classifying unlabeled observations by assigning them to the class of the most similar labelled examples.The features of the observations are collected for both training and test dataset.The most commonly used metric inthe calculations is the Euclidean distance.Another concept is the parameter k, which decides how many neighbours will be chosen for the kNN algorithm.The appropriate choice of k has a significant impact on the diagnostic performance of the kNN algorithm ([29]).

Figure 6 :
Figure 6: Combination of recall, accuracy and kappa in the different production zones for each algorithm.The average values for each metric across all folds are shown.In each case, the best performing configurations are represented.

Figure 8 :
Figure 8: Combination of recall, accuracy and kappa in the production zones for each algorithm.The average values for each metric across all folds are shown.In each case, the best performing configurations are represented.2/2

Table 3 :
Distribution of the status of production areas.Non-null sample values refer to samples in which there are no missing values.

Table 4 :
Summary table of the models parameter values used in the grid search.

Table 5 :
Summary table of the first approach with the models defined as the best in each of the production zones.

Table 6 :
Summary table of the second approach with the models defined as the best in each of the production zones.difference of 7% of positives compared to 93% of negatives.Therefore, areas such as Cangas F, Cangas G and Cangas H, which have a distribution of closures of around 60-40%, always obtain better results than areas where FAN is less frequent and where there are fewer cases for the analysis of this study, such as Redondela B, Redondela C and Redondela D, which have a ratio of closures of around 10%.

Table 9 :
Table with the input features associated with each test block in the Cangas H zone.The check marks when the feature was used .

Table 10 :
Table with the input features associated with each test block in the Cangas C zone.The check marks when the feature was used .

Table 15 :
Table with the input features associated with each test block in the Redondela C zone.The check marks when the feature was used .

Table 17 :
Table with the input features associated with each test block in the Redondela E zone.The check marks when the feature was used .

Table 18 :
Table with the input features associated with each test block in the Vigo A zone.The check marks when the feature was used