{'fraction_non_alphanumeric': 0.03144024685180552, 'fraction_numerical': 0.008214494203986324, 'mean_word_length': 4.73481587757054, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Parametric Learning of Associative Functional Networks Through a Modified Memetic Self-adaptive Firefly Algorithm

Functional networks are a powerful extension of neural networks where the scalar weights are replaced by neural functions. This paper concerns the problem of parametric learning of the associative model, a functional network that represents the associativity operator. This problem can be formulated as a nonlinear continuous least-squares minimization problem, solved by applying a swarm intelligence approach based on a modified memetic self-adaptive version of the firefly algorithm. The performance of our approach is discussed through an illustrative example. It shows that our method can be successfully applied to solve the parametric learning of functional networks with unknown functions.


Introduction
Models in science and engineering are usually expressed in the form of mathematical equations representing the reality with a given quality level. In addition to the free variables determining the degrees of freedom of the system, such equations usually involve some particular parameters accounting for the conditions of the problem. Learning such parameters is of paramount importance for an accurate and realistic description of the observed behavior of the system. This is also a very challenging task, typically demanding a lot of expertise, time, and effort from a human expert in order to get reliable results. Seeking to overcome this limitation, several approaches and methodologies have been devised to address this issue automatically. A classical example arises in neural networks, where several methods for parametric learning have been reported in the literature. In this work, we focus our attention on the functional networks, which are a powerful extension of the standard artificial neural networks (see our discussion in Sect. 2 for further details).
In this paper, we consider the problem of parametric learning of a classical model of functional networks, the so-called associative model, which is used to represent the associativity operator. This problem can be formulated as a nonlinear continuous least-squares minimization problem. We solve it by applying a swarm intelligence approach based on a modified memetic self-adaptive version of the firefly algorithm. The paper is organized as follows: functional networks and their main components are described in Sect. 2. Sections 3 and 4 discuss the problem to be solved, and the firefly algorithm and its variants, respectively. Section 5 describes the method used to solve this optimization problem. Section 6 discuss an illustrative example. The paper closes with the main conclusions and a brief discussion about future work.

Functional Networks
In short, functional networks can be regarded as a generalization of the standard artificial neural network in which the classical scalar weights of the neural networks are replaced by neural functions. This methodology was firstly described in 1998 by E. Castillo in [2] as a way to extend neural networks with new capabilities. Since then, they have been successfully applied to several problems in science and engineering. The interested reader is referred to [3] for a detailed explanation about functional networks, several examples and applications. Next paragraphs describe the main components of a functional network as well as the differences between neural networks and functional networks.

Components of a Functional Network
As the functional networks generalize the neural networks, they share several common features, including a close graphical representation. Figure 1(a) shows a functional network called associative functional network (discussed in detail in Sect. 3.1), which represents the associativity operator. Following this figure, we can identify the main components of a functional network. They are: 1. Some layers of storing units: in Fig. 1(a), we can see a first layer of input units, which contains the input information. In our example, this input layer consists of the units ξ, ζ and υ. We also have some intermediate layers of storing units. We point out that they are not neurons, but units storing some intermediate information. This set is optional and it is used to allow more than one neuron output to be connected to the same unit. For instance, in Fig. 1(a), we can see one layer with 4 intermediate units, represented by small circles in black. Finally, we have a layer of output units. In Fig. 1(a), it consists only of the unit μ. 2. One or more layers of computing units called neurons. Each neuron receives a set of input values, coming from the previous layer, makes some computations with them and returns a set of output values to the next layer. Neurons are represented graphically by circles, with the name of the corresponding neural function written inside. For example, in Fig. 1(a), we have 6 neurons arranged in two layers, where Φ and I represent the associative operator and the identity function, respectively. 3. A set of directed links, represented graphically by directional arrows. These arrows connect the input layer (or any intermediate layer, in general) to its adjacent layer of neurons, and neurons of one layer to its adjacent intermediate layers, or to the output layer. Note that the information flow is exclusively unidirectional: it always flows from the input layer to the output layer. The collection of all these features define the so-called network architecture or topology of the functional network, which determines the functional capabilities of the network.

Differences Between Neural Networks and Functional Networks
In spite of their similarities, there is a number of differences between neural networks and functional networks. The most important ones are: 1. Each neuron of a standard neural network returns an output value y = f ( w ik x k ) that depends only on the value w ik x k , where x 1 , x 2 , . . . , x n are the received inputs (see Fig. 2 (top)). This means that each neural function is always univariate, as opposed to the case of functional networks, in which the neural functions are multivariate, as shown in Fig. 2 (bottom). 2. The neural functions of the functional networks can be different (such as functions f 1 , f 2 and f 3 in Fig. 2 (bottom)). In contrast, the neural functions in neural networks are generally all identical. 3. The neural networks contain scalar values called weights, which must be learned. This component is not part of the functional networks, where neural functions have to be learned instead. 4. The neuron outputs of the neural networks are usually different. On the contrary, the neuron outputs of the functional networks can be coincident. In such cases, we obtain a set of functional equations, which have to be solved through specialized techniques, such as those reported in [2,3]. As a consequence, the neural functions in functional networks can be reduced in dimension or can be expressed as functions of lower dimension.
All these differences and features show that functional networks are more general and exhibit more interesting capabilities than the neural networks.

The Associative Functional Network
In this paper we consider the associative functional network, which represents the associativity operator Φ between two real numbers, given by: Our goal is to learn the function Φ by using functional networks. To this purpose, we consider the network topology shown in Fig. 1(a), which replicates the mathematical structure of Eq. (1). Initially, it seems that a two-argument function Φ is to be learned. However, Eq. (1) puts some constraints on it. In fact, it can be proved that the general solution of the functional Eq. (1) takes the form (see [3] for details): where ϕ(ξ) is a continuous and strictly monotonic (but otherwise arbitrary) function, which can only be replaced by η ϕ(ξ),with η being an arbitrary constant. Replacing now Eq. (2) in Eq. (1), the two sides of Eq. (1) can be written as: which means that the functional network in Fig. 1(a) is equivalent to the functional network in Fig. 1(b), where only a one-argument function ϕ has to be learned. This observation leads to two important conclusions: 1. This is the unique functional form for Φ that satisfies Eq. (1). So, the neurons Φ cannot be replaced by any other neurons. 2. The initial two-dimensional function Φ is fully determined by a univariate function ϕ. This means that the effect of the functional Eq. (1) is to reduce the initial degrees of freedom of Φ from a bivariate function to a univariate function ϕ.
Let us also assume that no information is available about the form of the function, but we still know that it is associative, i.e., it follows Eq. (1). To learn this associative operator, we can take pairs of numbers and their operated values as an interesting relation to be exploited for learning ϕ(ξ). Therefore, learning the associative functional network is equivalent to learning the function ϕ(ξ). To this end, we can approximate ϕ(ξ) by a function: where the {ψ i (ξ)} i1,...,β is a given set of linearly independent functions, with the ability to approximate ϕ(ξ) to the desired accuracy, and the coefficients δ i are the parameters of the functional network. Note that this means that they assume the role played by the weights in a neural network. In order to estimate the coefficients {δ i } i=1,...,β , we use the available data in the form of triplets (ξ j , ζ j , υ j ). According to Eq. (4) we must have for j = 1, . . . , α. Then, the error of the approximation can be measured as: To estimate the coefficients {δ i } i=1,...,β , we minimize the sum of squared errors: where λ is an arbitrary but given real constant, required to identify the constant η discussed above. To summarize, learning the associative functional network finally reduces to perform parametric learning on this approximation function ψ(ξ). This requires to solve a least-squares minimization problem: Unfortunately, this is a difficult multivariate nonlinear continuous optimization problem. In this paper, we address this issue by applying a swarm intelligence approach based on a modified memetic self-adaptive version of the firefly algorithm. The original firefly algorithm and the modifications introduced in this paper are briefly explained in next section.

Original Algorithm
In this work we rely on the firefly algorithm, a bio-inspired computational algorithm for optimization [14,15]. The basic inspiration for the algorithm is the observed flashing behavior of fireflies in nature; in particular, the variation of the intensity of light and the concept of attractiveness, which is assumed to be related with the encoded target function. The interested reader is referred to [16] for further details on the firefly algorithm. See also [4] for an updated review on bio-inspired computation at large.
The firefly algorithm is a population-based method in which the individuals (fireflies) are randomly distributed over the search space and perform exploration searching for the best location, related to the quality of the solution. The motion at iteration t+1 of a firefly i which is attracted by a more attractive (i.e., brighter) firefly j is governed by the following evolution equation: where the three terms on the right-hand side of the equation account respectively for the current position of the firefly, the attractiveness of the firefly to light intensity seen by neighbor fireflies, and a random movement of the firefly if it is the brightest one. Coefficients α and σ are random numbers uniformly distributed on the interval [0, 1]. Since its appearance, the firefly algorithm has been successfully applied to several problems in many different fields (see, for instance, [1,[6][7][8][9] for some illustrative applications). Also, several modifications and enhanced versions on the original algorithm have been developed [10,11,13]. We refer the reader to the paper in [5] for a review and taxonomic classification of several firefly algorithms and its variants and applications.

Modified Memetic Self-adaptive Firefly Algorithm
A promising line of research nowadays is given by the so-called memetic algorithms. Basically, they consist of the hybridization of a global search method with a local search procedure. In agreement with this, we consider here a modified version of the firefly algorithm that enhances the original algorithm with three additional features: the use of self-adaptation schemes on some control parameters, a new elitist population model, and the hybridization with a heuristics for local search.
The first modification consists of the application of self-adaptation schemes on some control parameters; in our particular case, this strategy is applied on the randomization parameter α, the attractiveness β, and the light absorption coefficient γ. For parameter α it is convenient to consider relatively large values at initial stages, thus promoting the explorative ability at the beginning of the simulation. Consequently, we apply a self-adaptive perturbation driven by: with α 0 = 0.9. This means that we start with a high randomization parameter value, e.g. α = 0.9, which corresponds to a system where fireflies are affected by a relatively large perturbation leading to a wide-range exploration, and slowly reduce it to lower values near to 0, where the system intensifies the exploitation around the local optima. At their turn, parameters β and γ undergo a process of uncorrelated mutation where each control parameter is perturbed additively according to the normal distribution modulated by the mutation strength of that parameter, as: where the mutation strength ζ t i , i = β, γ, also undergoes mutation determined by a characteristic time called the learning rate: where τ ∝ 1/ √ 2d and τ ∝ 1/ 2 √ d. The second modification concerns the population model. In the original firefly algorithm, the population of N P individuals is entirely replaced in each generation. Consequently, it misses some valuable features typically found in the evolutionary algorithms, such as the selection pressure for survival of individuals. As a matter of fact, even the best firefly in each generation is not preserved for the next generation. In our approach, at each generation we select a percentage p of the best fireflies to be preserved unaltered to the next generation. Similarly, we select a percentage q of the worst fireflies of the swarm and split it up into two subgroups of the same size, formed respectively by fireflies that are replaced by random solutions to increase the exploratory capacity of the swarm, and by fireflies that are copies (clones) of the best members of the swarm but then undergo mutation through an additive single-point, inductive uniform mutation at a single coordinate while all other coordinates remain unaltered.
Finally, this modified firefly algorithm is enhanced by its hybridization with a local search heuristics. In this work we apply the Luus-Jaakola local search method, a heuristic proposed in 1973 to solve nonlinear programming problems [12]. The method begins with an initialization step, in which random uniform values are chosen within the search space. This is achieved by computing the upper and lower bounds for each dimension. Then, a random uniform value within these bounds is sampled for each component. This value is additively added to the current position of the firefly location to generate a new candidate solution. This new solution replaces the current one if and only if this leads to a improvement of the fitness at the new position. Otherwise, the sampling space is multiplicatively decreased by a factor, freely chosen by the user. This workflow is repeated iteratively. With each iteration, the size of the neighborhood of the point is reduced, until eventually collapsing to a point.

Our Method
The modified firefly algorithm described in previous section has been applied to solve the parametric learning optimization problem described in Sect. 3.2. To this purpose, we need to determine some important choices. First of all, we need an adequate representation of the unknowns of the problem. The fireflies in our method correspond to real-coded vectors of length β + 1 corresponding to the free variables, {δ i } i=1,...,β and λ, of the least-squares minimization problem in Eq. (9). All individuals (fireflies) are initialized with uniformly distributed random numbers on the parametric domain for each coordinate. On the other hand, the fitness function corresponds to the evaluation of the least-squares function, given by Eq. (9).
Regarding the modified memetic self-adaptive firefly algorithm, some control parameters should be determined. As is usual in the field of metaheuristic techniques, the choice of suitable values for the control parameters becomes an important issue, as it affects the performance of the method at large extent. It is also a challenging problem, since it is strongly problem-dependent. In this work, our choice is mainly based on a large collection of empirical results. These control parameters and their values for this work are: -the number of fireflies, n f : we set this value to n f = 100 fireflies in this paper.
We also tested larger populations of fireflies (up to 300 individuals) at the expense of higher computation times, without any significant improvement, so we found this value to be appropriate in our simulations. -the number of iterations, n iter . Through numerical simulations, we found that n iter = 5000 is a suitable value, as convergence is achieved in all our simulations and higher values for n iter do not lead to any improvement in our results. -the initial attractiveness, β 0 : some theoretical results indicate that β 0 = 1 is a suitable value for many optimization problems. Accordingly, we consider this value in this paper, with positive results, as shown in next section. -the absorption coefficient, γ: its value is set up to γ = 0.5 in this work, since it provides a quick convergence of the algorithm to the optimal solution. -the potential coefficient, μ: in principle, any positive value can be used for this parameter. However, it is noticed that the intensity of light varies according to the inverse square law. Therefore, we decided to choose μ = 2 accordingly. -the randomization parameter, α. This parameter, which varies on the interval [0, 1], is used to decide the degree of randomization introduced in the algorithm, which, in turn, is used in order to generate new solutions and avoid to getting stuck in a local minimum. However, it has been noticed that larger values introduce strong perturbations on the evolution of the firefly and, eventually, delay convergence to the global optima. Consequently, it is preferable to select values between these extreme ends of the spectrum. In this work, we select α = 0.5.
-the percentage p of best solutions selected for elitism: it is set to p = 0.1, with the meaning that 10% of the best solutions are preserved to the next generation unaltered. -the percentage q of worst solutions for replacement: it is taken as q = 0.2, meaning that 20% of the worst solutions are replaced in our population for each generation. Among them, 10% are replaced by random fireflies to promote exploration, while the rest are replaced by copies of the best individuals selected for elitism and then further mutated, as explained in Sect. 4.2.
After the selection of suitable values for its parameters, the modified firefly algorithm is executed iteratively for the given number of iterations. With the purpose to remove the stochastic effects, and also to avoid premature convergence, 30 independent executions have been exectued for each experiment. Then, the firefly with the best (minimum) fitness value is taken as the best solution to the problem.

Computational Simulations
To check the performance of our approach, it has been applied to a practical example of an associative model with functional networks. The corresponding benchmark is given by the collection of data points shown in Table 1. The table displays a collection of 100 training points applied to learn the functional network. The parametric learning is achieved by solving the minimization problem in Eq. (9) through the method described in Sect. 5.
For the learning process in Eq. (5), we consider the family of Bernstein polynomials of degree ρ (which are linearly independent), given by: used to approximate the neuron function ϕ in Eq. (2), and perform parametric learning of the functional network.

Experimental Results
We have tested our results for different values of the polynomial degree ρ, starting with the simplest case (ρ = 1). The best solution obtained for the approximating function is given by the expression: Proceeding in the same way, we also tested our method for larger values of η. The approximate models associated with ρ = 2 and ρ = 3 are given by: and ϕ(ξ) = 0.395B 3 0 (ξ) + 0.5276B 3 1 (ξ) + 2.06B 3 2 (ξ) + 1.049B 3 2 (ξ), respectively. The performance of these models can be better measured in terms of the RMSE (root mean squared error), given by: RMSE = Λ α + 1 , which takes into account not only the approximation error but also the sample size used for training. Table 2 reports our experimental results. The table shows (in columns): the number of approximating functions, ρ, the number of free parameters, α + 1, and the averaged RMSE and maximum error values for the 100 training points (columns 3 and 4) and testing points (columns 5 and 6) in Table 1. As the reader can see, the RMSE shown in third column decreases as the number of approximating functions increases. We also performed cross-validation of our results to check for over-fitting. To this aim, we predicted the values of 500 data points and computed the prediction errors. The results for the RMSE are shown in columns 5 and 6 of Table 2. We can see that the RMSE and the maximum errors for the training and testing data are comparable. As a result, we can conclude that no over-fitting happens and our results can be safely validated.
All the computational work in this paper has been carried out on a 3.4 GHz Intel Core i7 processor, with 16 GB of RAM. The programming code has been implemented by the authors in the programming language of the popular scientific program Matlab, particularly on its version 2018b.

Conclusions and Future Work
In this paper we addressed the parametric learning problem of functional networks by considering a classical model: the associative functional network, which represents the associativity operator. We showed that learning this functional network for an unknown functions can be transformed into the problem of learning the parameters of an approximating function, leading to a multivariate nonlinear continuous minimization problem. We solved it by applying a modified memetic self-adaptive version of the firefly algorithm. The experimental results on an illustrative example used as a benchmark show that the method performs well and is able to obtain the learn all parameters of the model and hence, replicate the approximating model with good accuracy. Our results also show that the accuracy increases with the number of approximating functions. We also performed cross-validation by using two sets of data for training and testing, respectively. Since the obtained results are comparable, we concluded that no over-fitting occurs.
Our future work includes extending this methodology to other types of functional networks and to more sophisticated approximating functions. For instance, it is still an open problem to determine whether or not the method improves for other choices of the basis functions, such as shifted step functions, logistic functions, or the like. Applying this approach to some practical problems in different domains of science and engineering is also included in the plans for future work in the field.