Verification study on how macrofungal fruitbody formation can be predicted by artificial neural network

The occurrence and regularity of macrofungal fruitbody formation are influenced by meteorological conditions; however, there is a scarcity of data about the use of machine-learning techniques to estimate their occurrence based on meteorological indicators. Therefore, we employed an artificial neural network (ANN) to forecast fruitbody occurrence in mycorrhizal species of Russula and Amanita, utilizing meteorological factors and validating the accuracy of the forecast of fruitbody formation. Fungal data were collected from two locations in Western Hungary between 2015 and 2020. The ANN was the commonly used algorithm for classification problems: feed-forward multilayer perceptrons with a backpropagation algorithm to estimate the binary (Yes/No) classification of fruitbody appearance in natural and undisturbed forests. The verification indices resulted in two outcomes: however, development is most often studied by genus level, we established a more successful, new model per species. Furthermore, the algorithm is able to successfully estimate fruitbody formations with medium to high accuracy (60–80%). Therefore, this work was the first to reliably utilise the ANN approach of estimating fruitbody occurrence based on meteorological parameters of mycorrhizal specified with an extended vegetation period. These findings can assist in field mycological investigations that utilize sporocarp occurrences to ascertain species abundance.

been successfully used in mushroom cultivation and harvesting 50 .Moreover, Verma et al. 42 applied artificial neural networks and neuro-fuzzy inference systems to separate edible and inedible sporocarps.
Despite the fact that a number of studies have demonstrated that meteorological variables affect fungal development 42,[50][51][52][53][54] , no attempt has been made so far to quantify or predict the occurrence of fungus in natural and undisturbed habitats using non-linear modeling.Therefore, we aimed to evaluate the possible fructification of some selected fungal species applying species-specific combinations of weather parameters using multilayer perceptrons (MLP) with backpropagation (BP) algorithm for supervised learning.Russulaceae and Amanitaceae families are important and widespread taxa in Hungary with edible, inedible and poisonous representatives as well.Hence, the prediction of their occurrence is of high importance in terms of both scientific and human safety reasons.As a result of this investigation, it became possible to estimate the occurrence of fruitbodies of certain Russula and Amanita species in temperate forests of western Hungary with moderate to high accuracy for the first time.
The formation of fruitbodies of each species is worth investigating individually because different temperaturewater combinations induce their appearance according to their different ecological needs.There are few studies, especially for the economically important fungal species that examined the fruitbody formation of a particular species in a natural environment as a function of temperature and precipitation.For example, the water deficit in the soil due to dry summers, together with the high temperature, resulted in a decrease in fruitbody formation in some truffle (Tuber) species 55,56 .Our findings may open the possibility towards the integration of other fungal species into the estimation of their occurrence based on selected weather parameters with the highest R 2 scores.

ANN modeling of Amanita species
The goal of this study is to apply a mathematical method (ANN) that is able to predict the output of a non-linear ecological system, in our case: fruitbody formation.Figure 1 shows the results of the ANN model of A. mairei with input weather parameters, nodes and calculated weights.The occurrence of A. mairei was calculated by applying genus-level meteorological variables, such as cumulative heat amount for 3 weeks, pressure difference, and mean relative humidity for 3 days (selection based on Table 2).
The verification of the above mentioned ANN modeling for all species can be seen in Figs. 2, 3, 4, 5, 6, 7, 8, 9, 10, 11.Accuracy (Fig. 2) shows the rate of correct forecast (hit + correct negative) from all of the forecast data (hit + false alarm + missed + correct negative) (Table 3).The training session, where binomial outputs of fruitbody formation (Yes/No) were incorporated into the calculations, achieved high reliability of forecast, mostly above 0.9 in the case of genus-level meteorological variables (except for A. rubescens).Furthermore, there were mostly perfect forecasts (ACC = 1) for species-selected weather variables except for A. mairei, with a reliability of prediction of 96%.As it was expected, the testing session shows worse verification scores compared to that of the training session.However, a significant improvement can be observed in the case of forecasts based on species-selected weather parameters.The average accuracy score is 54% for predictions based on genus-level meteorological variables and 80% based on species-selected variables.
The next verification index is Bias (Fig. 3).Bias is the rate of all forecasted (hit + false alarm) and all observed (hit + missed) fruitbody formation.If Bias is 1, the number of false alarms and missed forecasts are equal, which can be seen as a perfect forecast if both numbers are zero.If Bias is greater than one, the fruitbody formation is overestimated.If the Bias is smaller than one, the event is underestimated.In the training session for speciesspecific weather variables, the Bias with scores of 1 reflects the perfect prediction of fruitbody formation, which is  3) from all forecast data (hit + false alarm + missed + correct negative).The score is 1 for a perfect forecast.

Figure 3.
Bias is the rate of all forecasted (hit + false alarm) and all observed (hit + missed) fruitbody formation.If Bias is 1, the numbers of false alarm and missed forecast are equal, which can be seen as a perfect forecast if both number is zero.If Bias is greater than one, the fruitbody formation is overestimated.If bias is smaller than one, then the event is underestimated.
Vol.:(0123456789) and false alarms was equal).There was overestimation only in one case, in the species-selected testing session of A. rubescens, where the Bias was two.
The results of probability of detection (POD) index are presented in Fig. 4. POD is the rate of correct hits out of all fruitbody occurrences (hit + missed).If the probability is 1, i.e. the detection is 100%, all of the fruitbody formation was perfectly predicted.The difference between the results of fixed (genus-level) and selected weather parameters is obvious.While the detection rate in the case of genus-level variables for the training session was 70%-75% (60% for A. phalloides), the detection was 100% for most species in the training session (86% for A.     False alarm ratio (FAR) is the rate of false detections out of the summarized value of hits and false alarms.If the index was zero, there were no false forecasts of fruitbody formation.The value of FAR was high in the cases of the testing session both for genus-level and species-specific weather parameters, especially for A. rubescens and A. vaginata (Fig. 5).There were no false forecasts in the training session of species-specific weather parameters, while a decrease of scores can be observed in the testing session.The average score of FAR for genus-level Figure 8. Bias is the rate of all forecasted (hit + false alarm) and all observed (hit + missed) fruitbody formation.If Bias is 1, the number of false alarms and missed forecasts is equal, which is seen as a perfect forecast if both numbers are zero.If Bias is greater than one, the fruitbody formation is overestimated.If bias is smaller than one, then the event is underestimated.www.nature.com/scientificreports/variables in the testing session was 0.611; for the selected variables in the testing session, it was 0.167; therefore, the false alarm ratio was significantly better in the case of species-specific weather parameters.The critical success index (CSI) is the most rigorous index.It shows the rate of correct hits out of the summarized value of all correct, missed and false detections of fruitbody formation.For a perfect forecast, the score of CSI is one.The difference between the reliabilities of forecasts based on genus-level and species-specific weather parameters was the most obvious here (Fig. 6).The result of the training session for selected weather parameters reflects the perfect estimation of fruitbody formation (except A. mairei with 86%), while the CSI of the training session for genus-level variables varied among 0.57 and 0.75.The differences between the testing sessions were also significant.There were perfect forecasts for A. mairei and A. pantherina; forecasts with CSI of  www.nature.com/scientificreports/0.33 and 0.5 were characteristic of A. phalloides and A. rubescens, respectively.There were no correct forecasts for A. pachyvolvata and A. vaginata (CSI = 0).In the case of genus-level weather parameters, there were only two species for which CSI was not zero (0.5 and 0.2 for A. phalloides and A. rubescens, respectively).

ANN modeling of Russula species
The same verification indices were calculated for the results of ANN modeling of the fruitbody formation of Russula species.The accuracy of the forecast of Russula species is presented in Fig. 7. Calculation with genus-level meteorological variables showed an accuracy of 91% for R. grata and 96% for R. atropurpurea, R. heterophylla, R. nigricans, and R. olivacea.Perfect forecasts were performed for R. ochroleuca and R. virescens.In the cases of species-sepecific weather parameters, the Accuracy was 100% in all cases.The testing part of ANN modeling is always critical because this part of the process means the blind forecast of the fungal appearance.The lowest Accuracy score was 40% in the case of genus-level weather variables and for R. olivacea.The average score in this group was 68.57%.The lowest score was slightly higher (60%) in the cases of selected variables, testing part.The average score of Accuracy was 71.43%.Bias indicates the over-or the underestimation of the model (Fig. 8).The fruitbody formation of Russula species in the case of genus-level variables, training session was underestimated for R. atropurpurea (0.88), R. nigricans (0.92), R. olivacea (0.83) and overestimated for R. heterophylla (1.25).There was no significant difference (BIAS = 1) for R. grata, R. ochroleuca, and R. virescens.The Bias of the training session for species-specific weather parameters was 1 for all Russula species.The testing session shows the blind forecasts, i.e. using all the weights calculated in the training session for the prediction of fruitbody formation.In the case of genus-level variables the Bias was more balanced.Bias was 1 for 4 out of 7 species (Fig. 8), there was underestimation in two cases (R. heterophylla, R. olivacea, B = 0.0 and B = 0.50, respectively).A significant overestimation for R. ochroleuca was also observed (B = 3.0).In the training session for species-selected weather variables, the Bias was increased and overestimation was seen for R. antropurpurea, R. nigricans, R. olivacea, and R. virescens.Underestimation was detected for R. heterophylla and R. ochroleuca.The only species where Bias was 1 in all training and testing groups was R. grata.
The scores of Probability of detection (POD) were higher for the species-selected variables than for the genus-level weather parameters (Fig. 9).In the training session, the lowest value, even for genus-level weather variables, was as high as 83%, which suggests high reliability of detection.In the training session for the speciesspecific weather variables, POD was 1 for all species, which means perfect detections of fruitbody formation.In the testing session, the detection takes only two values: 0 and 1.The detection of fruitbody formation in the case of genus-level weather variables was totally missed for R. atropurpurea, R. heterophylla, R. olivacea, and R. virescens.However, the detection was perfect for three species (R. grata, R. nigricans, and R. ochroleuca).The weather parameters for the species-specific cases showed a higher probability of detection; 5 out of 7 Russula species were detected perfectly (POD = 1).In the case of R. heterophylla none of the methods (genus-level or species-specific variables) were able to successfully detect the fruitbody formation.
False alarm ratio (FAR) was suitable to describe the false detections (Fig. 10).It was logically connected to the results of Bias (Fig. 8).When the fruitbody formation was overestimated, the number of false alarms should have been higher.In our study, nothing but false detections (FAR = 1) were found for R. nigricans and R. virescens for genus-level variables in the testing session.However the False alarm ratio was high for R. atropurpurea also (FAR = 0.75).If the index is zero, there were no false forecasts of fruitbody formation.R. grata, R. heterophylla and R. ochroleuca should be mentioned as there were no false detections in their testing sessions at all.Critical success index (CSI) was taken into consideration for all the observed and forecasted occurrences of fruitbody formations.CSI was 1 when there were neither false alarms, nor missed hits.As it was seen for the other indices, the forecasts were perfect in cases of species-specific weather parameters during the training session (Fig. 11).CSI scores increased for 3 out of 7 species and decreased for 2 out of 7 species during the testing session, contrasting the methods of genus-level and species-specific weather parameters.CSI increased for R. antropurpurea, R. olivacea, and R. virescens, while decreased for R. nigricans and R. ochroleuca.No change in CSI scores was observed for Russula grata and R. heterophylla.
Based on our results, it can be concluded that the ANN properly works for forecasting the appearance of mycorrhizal groups.However, we do not know how it would work for xylophagous, soil saprotrophic species, since they live in a different ecological niche.Furthermore, in this study, we do not deal with small groups such as coprotrophs, species living on herbaceous plant remains, parasites on insect pupae etc., because there is not enough data available for a sufficient statistical analysis.
The study and the presented results have practical importance, since the ANN method is able to forecast the possible occurrence of the fruitbody using actual weather data.These meteorological parameters are widely available and easy to calculate, so they need low costs and computational demand.In comparison to camerabased systems, such as CCD-type cameras, which have very high acquisition costs due to their exceptional sensitivity.Moreover, camera-based analysis is limited in scope, as images can only be captured in locations where cameras are deployed.In the future, the above-presented ANN-based fruitbody estimation technology may play a vital role in overcoming former limitations.
Nevertheless, a more frequent, i.e. weekly forecast of fruitbody formation may significantly speed up the ongoing mycological researches, as it increases the chances of collecting a given taxon faster.
Since fruitbody formation data stems from two experimental sites with very similar macroclimatic background, therefore in order to broaden the applicability of ANN, it is recommended to include more locations.Also, in the future we will extend the investigations to the fruitbody formation of species belonging to other functional groups (soil saprotrophic, xylophagous etc.) in order to find out for which groups the method can still be applied.Lastly, as a further extension of the scope of ANN applicability, it can be inferred from the

Discussion
Based on the results of this study, the current work is novel in its field from different perspectives.First, to the best of our knowledge, this study is the first to introduce their application for evaluating the formation of macrofungal fruiting bodies in natural and undisturbed habitats.Moreover, only a handful of fungal species, including Agaricus bisposrus 57 , Oudemansiella raphanipes, and Pleurotus eryngii 58 , have been studied previously; however, the analyses presented in this work represent the first ANN application results for Russula and Amanita species.
Learning algorithms have been mostly applied in mycology for decision-making processes such as the recognition of fungi by images 43 , the consumability of fungi 59,60 , or control systems for mushroom farms 61 .In the work of Hernández-Rodríguez et al. 62 , vegetation characteristics and their effect on the occurrence prediction of king mushroom (Boletus edulis) were investigated.They found that the mean height of the scrub vegetation was the most reliable parameter for the prediction of fruitbody production 62 .Furthermore, Solanki et al. 63 conducted a survey on weather prerequisites for the fructification of Phellorinia species, but this work only utilized air temperature, relative humidity and total rainfall.From these data, they attempted to find correlation among the weather parameters and fruitbody occurrence (26 th to 36 th calendar weeks) and from these results, they identified the most probable starting date of the initiation and termination of fruitbody formation (23 th to 39 th calendar weeks) as the most suitable conditions to conduct domestication experiments 63 .Although the role of weather and vegetation conditions on fruitbody formation is extensively studied [62][63][64] , ANN models have not yet been applied and verified for the prediction of fruitbody formation.
There is a significant effect of air pressure and temperature on the fruitbody formation for Amanita species, and it is generally characteristic for all studied species of Amanita genera.In order to extend this conclusion, it would be beneficial to increase the number of studied Amanita species in the future.
The prediction of fruitbody formation based on genus-level, meteorological variables for Amanita species was less reliable than species-specific weather parameters.The ANN model achieved two perfect forecasts, namely for A. mairei and A. pantherina.Another noteworthy result was achieved in the case of A. rubescens, which can be estimated with 80% accuracy and 100% probability of detection, however there is an overestimation in the model.The less reliable estimation occurred for A. pachyvolvata and A. vaginata, because of the lack of successful fruitbody forecast, i.e. the model did not predict any occurrence of fruitbody formation in any case.An explanation for these diverse results may be that the species complex is large, the taxonomic classification of the species is unclear 65,66 , and therefore, it is still in progress [67][68][69] .
The influence of environmental factors was much more diverse for Russula species than for Amanitas, which was also reflected in the selection of genus-level weather parameters and their correlations to fruiting body formation.
As for the testing session of the Russula genera, the results of the verification indices using genus-level weather variables were of a higher standard than anticipated from the Amanita species.In the case of two species, namely R. grata and R. nigricans, the forecast of fruitbody formation was perfect.In addition, R. ochroleuca may be mentioned with moderate scores of accuracy and with significant overestimation of occurrences.Other species from Russula genera had very low scores and weak forecasting reliability.In the case of species-specific weather parameters, the results showed that verification indices had lower standard deviations compared to the genus-level meteorological variables.The reliability of the estimation of fruitbody formation was the highest for R. grata, high for 3 out of the 7 Russula species (R. nigricans, R. antropurpurea, and R. virescens), and moderate for R. olivacea.The estimation of R. heterophylla and R. ochroleuca was the least reliable.All in all, the number of successful predictions was 3 out of 7 species in the case of using genus-level weather parameters and 5 out of 7 species for species-specific meteorology.In those cases, where neither genus-level, nor species-selected variables were successful in the prediction of fruitbody formation (e.g.R. heterophylla and A. pachyvolvata), other possible internal or external effects must presumably exist which can have more significant influence on fungal formation than meteorology.
It may be inferred from the outcome of the investigation that artificial neural network (ANN) is able to predict the occurrence of mycorrhizal groups with medium to high probability.The functioning of xylophagous, soil saprotrophic organisms in a distinct ecological niche remains unknown.Due to insufficient data for statistical analysis, we do not do research on small groups such as coprotrophs, species that rely on herbaceous plant remnants for survival, or parasites that inhabit insect pupae.
The findings indicate that the approach employed in this study may not be universally applicable for forecasting the emergence of fruiting bodies, especially in the case of mycorrhizal fungi species with a notably brief growth period.Examples of such species include the winter truffle (Tuber brumale), which has a brief fruiting phase lasting only two months during the winter and mycorrhizal coralline fungi, such as the greening coral (Ramaria abietina), that exclusively generates reproductive structures during the fall season.Also, the applicability of ANN on xylophagous, soil saprotrophic organisms remains uncertain due to their occupation of a distinct ecological niche.In addition, this study does not include analysis of small groups such as coprotrophs, species that live on herbaceous plant remnants, or parasites on insect pupae.This is due to insufficient data for a comprehensive statistical analysis.
The limitations of the results of ANN can originate from the lack of precise in-situ microclimatic measurements of meteorological variables, although, due to the random nature of the appearance of the fungal bodies, it is not possible to satisfy this condition even with today's technological solutions.Eliminating this deficiency is one of the main reasons for using ANNs.The reliability of forecasting fruitbody formation can be

Materials and methods
The structure of our work is presented in Fig. 12.Firstly, those weather parameters were determined on genuslevel and species-specific levels, which showed the highest correlations with fruitbody formation.As a second step, the dataset in both cases was partitioned randomly into two parts containing 70% and 30% of the data, which are called the training session and the testing session, respectively.The artificial neural network, as a learning algorithm, used the training session to determine the best approximation of macrofungal formation as a binomial output (Yes/No) based on the weather parameters.The testing session was used to obtain real forecasts as the results of the non-linear algorithm acquired by the ANN.In the last but considerable step, the verification of the results of the training and testing sessions was achieved to prove the reliability of the forecasts.

Experimental areas
Vendvidék is the westernmost area of Hungary and also of the Carpathian Basin.The region is a "mushroom paradise," where most macrofungi species fructify in the country due to its unique climatic and geographical features as well as its nearly complete forest cover.Consequently, the mycological literature is extensive, and their study in the field is thorough.Siller et al. 70 published the distribution of protected macrofungal taxa, while Siller et al. 71 reported an annotated checklist of hundreds of macrofungal species in the region.Connectedly, a current ecological study 72 was also released.The sample size is around 2 km 2 .The area is mosaic-like, with roads and settlements, and consists of 3 forest blocks.The forest stands here are homogeneous with mixed forests of oak, beech, hornbeam, birch, Scots pine, spruce and alder.

Studied species
As long-term monitoring of fungi is ongoing in both areas, the number of documented macrofungal species in the two areas so far exceeds 600 species, which are being processed and published in the close future.For the species selected for this study, several important criteria had to be taken into account.Most importantly, they had to be exclusively associated with forest habitat, as the surveys were carried out in the forest.It was therefore obvious that mycorrhizal species had to be selected.In addition, the presence of a wide range of mycorrhizal partners in both areas (both deciduous and coniferous tree species) was an important factor.Another important factor was the longest possible growing season, i.e. the potential for the species to develop a growing season from summer to late autumn.The next criterion was to have occurrence data from both sites.Finally, it was important to have sufficient occurrence data for analysis.Because of these criteria, most documented species were eliminated, with selected species of the genera Amanita and Russula proving to be the most ideal.These species are also known to be important edible and toxic species in Hungary.

Field surveys
Twenty-eight survey days were chosen, 15 days of which in Vendvidék between 2018 and 2020 and 13 days in Vétyem forest reserve between 2016 and 2020 (Table 1).Sampling was carried out during the main growing season from mid-summer to late autumn.At each sampling event, a complete field survey was carried out to find all species that were currently producing fruiting bodies.Species were identified from genus monographs and nomenclature was based on the Index Fungorum (January 2023).The number of fruitbodies was not directly recorded, but in all cases, the number of registered fruitbodies exceeded the one.On the other hand, the appearance of a large (> 100/ha) number of fruitbodies of particular mycorrhizal species usually occurs when some kind of extreme environmental impact affects the given species (e.g.deforestation, road construction, breaking of the waterproof layer of the soil).It can be stated that extreme human interventions did not occur in any of the areas in the examined time period, so there was no mass fruitbody production as a result of stress.
The lifespan of the fruitbodies of the examined species is 5-6 days on average.Of this, 3 days is considered a 'fresh' state, when most of the spore formation and spore emission takes place 74 .
The fungus observations from the two locations were merged owing to the similar climatic conditions, therefore the sample size for the ANN models was overall 364 (13 species × 28 survey days) for Russula and Amanita species.The detailed number of occurrences can be seen in Fig. 14.The sample size for each species (i.e. the 28 data per species) was appropriate for ANN calculations 75 .The output of occurrences is binary (1 or 0), e.g. in the case of Amanita mairei there were found fruitbodies 4 times out of the 28 survey days and there were not found any fruitodies 24 times out of the 28 survey days.The exact number of fruitbodies were not used for the calculations.The sample size (28 fungal data per ANN calculation) was appropriate for the ANN method (Haykin, 2009).
1.If the R 2 > 0.5 for at least one weather variable, then the two weather parameters with the highest R 2 scores were selected, each is one of a kind in order to avoid duplication of weather parameters with the same origin (i.e.temperature-based parameters, precipitation-based parameters, humidity-based parameters).The mean temperature and accumulated heat amount were considered to be of different origin based on the different calculation methods.2. If the R 2 ≤ 0.5 for all weather variables, then the three weather parameters with the highest R 2 scores were selected, each is one of a kind (see above).
Increasing the number of input weather parameters did not increase the efficiency of ANN calculations as well as the stability and reliability of the forecasts, but instead, it led to increased computational demands.Table 2 contains the genus-level and species-specific meteorological variables for Amanita and Russula species.In the case of genus-level meteorological parameters for Russula species, the R 2 scores were so low (R 2 ≤ 0.1) that only two parameters were selected for ANN calculations.

Collinearity diagnostics
The High Variance Inflation Factor (VIF) was used to check the collinearity.First, the weather parameters belonging to the ANN calculations of each Amanita and Russula species were checked (Figs. 15 and 16), and then all the weather parameters were used in order to show that involving all the weather parameters would not lead to an appropriate result (Figs.17, 18).
The values of VIF range from 1 to infinity.A general rule of thumb for interpreting VIF is as follows 79 : • VIF ≈ 1 there is no correlation between a given predictor variable and any other predictor variables in the model.• VIF ϵ (1, 5] moderate correlation between the predictor variable and other predictor variables in the model, however, the severity is typically not significant enough to necessitate immediate attention.• VIF > 5 potentially strong correlation between the predictor variable and other predictor variables in the model.Under these circumstances, the coefficient estimates and p-values presented in the regression output are likely to be unreliable. It can be stated that there is no collinearity among the independent variables in any case of the ANN predictions of fruitbody production regarding to the Amanita species (Fig. 15) and Russula species (Fig. 16).

Artificial neural network
Most processes in ecosystems behave non-linearly, therefore their mathematical approach should be able to satisfy that condition.Recently, the widely used learning algorithms, such as artificial neural networks, are able to handle and solve this scientific issue effectively.
In this study, multilayer perceptrons (MLP) were used with backpropagation algorithm for training feed-forward neural networks 9 .In an ANN model, similarly to the neurons' connection in the brain, there are interconnected groups of nodes.Our model consists of three layers (Fig. 19).The input layer contains the meteorological parameters as independent variables.The hidden layer, which can be seen as a black box, obtains the weights by The formula for calculating the ith node (y i ) in the hidden layer (Fig. 19) is the following: Table 2. List of selected variables (cells with bold) and R 2 scores for ANN calculation in the cases of genuslevel weather parameters for all Amanita and Russula species and species-specific weather parameters selected by using the main principles decribed above.The whole list can be seen in Supplementary material (Tables 7,  8).VIF values, where all the weather variables seen in Fig. 15 were included in the multicollinearity calculations for Amanita species in order to show that involving all the weather parameters would not lead to an appropriate result.
Figure 18.VIF values, where all the weather variables seen in Fig. 16 were included in the multicollinearity calculations for Russula species in order to show that involving all the weather parameters would not lead to an appropriate result.
where "i" refers to the number of the neuron in the hidden layer, w j i refers to the weight calculated from the nth meteorological parameter in the input layer, and b i means the bias term for the i th node.The activation function was a sigmoid function, i.e.
As a chain, the output layer (fruitbody production, FP) can be calculated by using y i, as a new input, e.g.
During the optimization process, the ANN is trained to minimize the cost function between the estimated and observed data of fungal production by finding the optimal values of w ji, b i , w iz , b z 75 .The rate of training and test sessions in the dataset is 70% and 30%, respectively 80 .The order of the data was shuffled randomly in every calculation so that the 70%-30% split did not affect the results.The number of iterations in each ANN calculation was 100, from which the version with the lowest error was chosen as the best estimation of fruitbody development.
The possible source of error is the so-called overfitting 81 .This means that the model has more connections and weights than data in the input dataset.In our case, the input dataset in every case is more times bigger than the number of connections (see Figs. 1 and 14).
The ANN calculations were performed with R v4.1.2statistical software 82 using the R package "neuralnet" library 83 .

Alternative ANN methods
In this study, we had to find a method suitable for estimating binary outputs (fungal fruitbody formation YES/ NO) based on continuous input data (meteorological parameters), and this method also had to be able to handle non-linear ecological systems.It has long been known that artificial neural networks are more successful than traditional regression methods 84 .In addition, several studies have shown that neural networks are suitable for binary classification.Jeatrakul and Wong 85 tested five artificial neural network methods for binary outputs, namely back propagation neural network (BPNN), radial basis function neural network (RBFNN), general regression neural network (GRNN), probabilistic neural network (PNN), and complementary neural network (CMTNN).Radial basis function neural network (RBFNN) is similar to BPNN (which is used in our study), the only difference is in the training speed 86,87 .In our case, the training speed is out of consideration as the dataset did not require such troubleshooting.As for the general regression neural network, according to Specht 88 , the GRNN is more suitable for estimating continuous output data.Rutkowski 89 also highlighted the effectiveness of GRNN based on a non-parametric regression method for the identification of time-varying continuous outputs.As a consequence, it was considered more appropriate to choose another method in our study.The probabilistic neural network is a type of radial basis network 90 .In the cases of probabilistic neural networks, the sigmoid activation function is replaced by an exponential function.The computational time can be drastically reduced, so this technique may be a good solution for problems in which the incremental adaptation time of back-propagation is a significant fraction of the total computation time 91  (Specht, 1990).So that was out of the scope in our case.At last, the complimentary neural network must be taken into consideration as an alternative method.CMTNN uses two opposite feedforward backpropagation neural networks, the so-called Truth and Falsity Neural Networks.However, the literature has a poor description of the method, Jeatrakul and Wong 85 found that the best method for binary classification problems is CMTNNs.Based on the above-introduced neural network methods, the back-propagation neural network (BPNN) seemed to be the best solution to estimate fungal fruitbody formation as a binary classification problem in our study.

Validation of results
The validation of the prediction of the fruitbody formation was achieved based on the contingency table shown in Table 3. following Fagerland et al. 92 .The verification indices are seen in Table 3.The five most relevant verification indices used in practice are Accuracy (ACC), Bias (B), Probability of detection (POD), False alarm ratio (FAR) and Critical success index (CSI).All of the indices are dimensionless.ACC, POD, FAR and CSI varies between 0 and 1, while B shows that the method overforecasts or underforecasts the event (Table 4).

Declaration
Experimental research and field studies on plants comply with relevant institutional, national, and international guidelines and legislation.4. Verification indices based on the terms in Table 3.

Index Formula Assessment
Accuracy ACC = a+d

Figure 1 .Figure 2 .
Figure 1.ANN model of Amanita mairei Foley with genus-level meteorological parameters (Tsum_3weeks, pressure difference and mean relative humidity for 3 days based on Table2).Number of neurons in the hidden layer is 3. Error is 0.013274, steps in the hidden layer is 90.Blue lines represent the bias terms just like the intercept in a linear model.

Figure 4 .
Figure 4.The rate of correct hit out of all fruitbody occurrence (hit + missed).If the probability is 1, i.e. the detection is 100%, then all of the fruitbody formation were correctly predicted.The cell is empty when the divisor was zero.

Figure 5 .
Figure 5.The rate of false detections out of the summarized value of hits and false alarms.If the index was zero, there was no false forecasts for fruitbody formation.

Figure 6 .
Figure 6.The rate of correct hits out of the summarized values of all correct, missed and false detections of fruitbody formation.In case of a perfect forecast, CSI is one.

Figure 7 .
Figure 7.The rate of correct forecasts (hit + correct negative, see Table3) out of all forecast data (hit + false alarm + missed + correct negative).The score is 1 for a perfect forecast.

Figure 9 .
Figure 9.The rate of correct hits out of all fruitbody occurrences (hit + missed).If the probability was 1, i.e. the detection was 100%, which represented correctly predicted fruitbody formations.

Figure 10 .
Figure 10.The rate of false detections out of the summarized value of hits and false alarms.If the index is zero, there was no false forecasts of fruitbody formation.

Figure 11 .
Figure 11.The rate of correct hits out of the summarized values of all correct, missed and false detections of fruitbody formations.For a perfect forecast, the CSI score is one.

Figure 12 .
Figure 12.The flow chart of our work ranging from the weather parameters' selection to the presentation of the results of the verification indices.

Figure 13 .
Figure 13.Locations of the two study areas in Vendvidék and in Vétyem forest reserve, western Hungary.

Figure 14 .
Figure 14.Number of days of sporocarp occurrences (Yes or No) out of the 28 survey days for (A) Amanita species; (B) Russula species.The output of occurrences is binary (1 or 0), e.g. in the case of Amanita mairei there were found fruitbodies 4 times out of the 28 survey days and there were not found any fruitodies 24 times out of the 28 survey days.The exact number of fruitbodies were not used for the calculations.The sample size (28 fungal data per ANN calculation) was appropriate for the ANN method(Haykin, 2009).
https://doi.org/10.1038/s41598-023-50638-8www.nature.com/scientificreports/calculating the gradient of the loss function and tries to minimize the errors by iterating always backwards from the last layer.These computational subunits in the hidden layer are called nodes.The output layer obtains the binomially distributed (Yes/No) dependent values of fruitbody formation as the result of non-linear calculations.Our ANN model is supervised, i.e. the training session learns from the known values of meteorological input data and the fungal output dataset.The testing session of the ANN model applies the mathematical formula and the weights obtained from the training session and estimates the output of fungal occurrences (Yes/No).

Figure 15 .Figure 16 .
Figure 15.VIF values based on the predictor variables which were used to estimate the fruitbody formation of Amanitas in ANN.

Figure 17 .
Figure17.VIF values, where all the weather variables seen in Fig.15were included in the multicollinearity calculations for Amanita species in order to show that involving all the weather parameters would not lead to an appropriate result.

Figure 19 .
Figure 19.Sematic model of an artificial neural network.Based on the neurons' connections in the brain, there are similarly interconnected groups of nodes in the model.The input layer contains the meteorological parameters as independent variables, and the output layer obtains the binomially distributed (Yes/No), dependent values of fungal sporocarp production as the result of non-linear calculations.The hidden layer is a so-called black box, where the minimization of errors is computed by a learning mechanism using the training dataset.
a perfect forecast Critical success index CSI = a a+b+c CSI ϵ [0; 1] CSI = 1 for a perfect forecast

Table 3 )
out of all forecast data (hit + false alarm + missed + correct negative).The score is 1 for a perfect forecast.

Table 1 .
List of survey days in Vendvidék and in Vétyem forest reserve.

Table 3 .
Contingency table for the verification of ANN models.