Method for predicting type-2 fuzzy neural network model based on optimized whale algorithm

By introducing the optimized whale algorithm and a variety of evolutionary strategies into the type-2 fuzzy neural network model, the problem of strong dependence on local optimal solutions and parameter configurations is solved, the robustness and generalization ability of the model are improved, and better results are achieved. complex problem processing and noisy data processing.

CN118747508APending Publication Date: 2024-10-08NANJING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410224370.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-02-29
Publication Date
2024-10-08

AI Technical Summary

Technical Problem

When the existing technology handles complex problems and noisy data, the Type II fuzzy neural network model may fall into a local optimal solution, and the whale optimization algorithm has strong dependence on parameter configuration, making it difficult to adapt to the needs of different problems.

Method used

The second-type fuzzy neural network model based on the optimized whale algorithm is used to introduce the strategy of simultaneous evolution of multiple populations and the information interaction mechanism between populations. It combines the attention mechanism layer, fuzzy mapping layer, rule triggering layer and fuzzy reduction layer to optimize the antecedents. and subsequent parameters to enhance global search capabilities.

Benefits of technology

The robustness and generalization ability of the type-2 fuzzy neural network model is improved, it can better handle fuzziness and uncertainty, avoid local optimal solutions, and enhance parameter identification and search performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118747508A_ABST
    Figure CN118747508A_ABST
Patent Text Reader

Abstract

The invention discloses a method for predicting a type-2 fuzzy neural network model based on an optimized whale algorithm. The type-2 fuzzy neural network model is defined, and the type-2 fuzzy neural network model is composed of n input variables, an output variable and k rules. As shown in the following figure, the type-2 fuzzy neural network model is a neural network model structure composed of an attention mechanism layer, a type-2 fuzzy mapping layer, a rule trigger layer, a fuzzy drop layer, a consequent set layer and a result output layer. The invention provides an optimized whale algorithm which is used for optimizing the search performance of front part and back part parameters in a type-2 fuzzy neural network model. According to the whale optimization algorithm, a strategy of simultaneous evolution of multiple populations is adopted, the population diversity can be improved, the global search capability is enhanced, and parameter identification and search in a type-2 fuzzy neural network model are well improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of intelligent optimization algorithm technology and type-II fuzzy neural network model technology, and in particular to a prediction method of a type-II fuzzy neural network model based on an optimized whale algorithm. Background Art

[0002] Type-2 Fuzzy Neural Network is a computational model that combines fuzzy logic and neural networks, designed to handle fuzzy and uncertain information. It is an extension of Type-1 Fuzzy Neural Network, in which Type-1 Fuzzy Sets are replaced by Type-2 Fuzzy Sets. Type-2 fuzzy sets introduce additional uncertainty, where the membership of each element in the set is modeled as a Type-1 fuzzy set, i.e., a function, rather than a single fuzzy value. This means that Type-2 fuzzy sets have greater expressive power and can better handle complex uncertainties. Type-2 Fuzzy Neural Network has a wide range of applications in pattern recognition, control systems, decision support systems, and other fields. Due to its ability to handle uncertainty and fuzziness, it has advantages in handling complex problems and data with noise, can better handle fuzziness and uncertainty, and improves the robustness and generalization ability of the system.

[0003] The Whale Optimization Algorithm (WOA) is a heuristic optimization algorithm inspired by the behavior of whale groups and is used to solve continuous optimization problems. The algorithm aims to simulate the process of whale groups collaboratively searching for food sources to find the global optimal solution. The WOA algorithm has strong global search capabilities and is suitable for a variety of optimization problems, including function optimization, parameter adjustment in machine learning, engineering design and scheduling problems. The performance of the WOA algorithm depends on the selection and adjustment of parameters, and different problems may require different parameter configurations. For complex problems, the WOA algorithm may fall into a local optimal solution, so it is necessary to consider improved variants and hybrid algorithms. Summary of the invention

[0004] In view of the above existing problems, the present invention is proposed.

[0005] Therefore, the present invention provides a prediction method of a type-II fuzzy neural network model based on an optimized whale algorithm. Due to its ability to handle uncertainty and fuzziness, it has advantages in processing complex problems and data with noise, can better handle fuzziness and uncertainty, and improves the robustness and generalization ability of the system.

[0006] In order to solve the above technical problems, the present invention provides the following technical solutions, a prediction method based on a type-II fuzzy neural network model with an optimized whale algorithm, comprising:

[0007] The training data are collected and preprocessed; a type-II fuzzy neural network model is constructed based on the preprocessed data; a strategy of simultaneously evolving multiple populations is introduced, an information interaction mechanism between populations is introduced, and the whale algorithm is optimized.

[0008] As a preferred solution of the prediction method of the type-II fuzzy neural network model based on the optimized whale algorithm described in the present invention, wherein: the type-II fuzzy neural network model includes an attention mechanism layer that allows the type-II fuzzy neural network model to allocate attention weights at different positions according to the specific content of the input when processing sequence data;

[0009] The attention mechanism layer processes data including the input feature matrix X. The input parameter of the type-II fuzzy neural network model is a two-dimensional matrix with a size of [batchSize, inputSize], where batchSize represents the batch size and inputSize represents the dimension of the feature.

[0010] Initialize the learning parameters, including the weight matrices Wq, Wk, and Wv of the query Q, key K, and value V. The weight matrix is ​​used to map the input features to the query, key, and value space, where:

[0011] Wq=randn(inputSize,inputSize)

[0012] Wk=randn(inputSize,inputSize)

[0013] Wv=randn(inputSize,inputSize)

[0014] Wq, Wk and Wv are used to linearly transform the input data and project the input data into the space of query Q, key K and value V, where Wq is the query weight matrix, which is used to map the input data to the query vector space. The weight of each row represents a specific query vector, which is used to measure the importance of the input data at each position to other positions; Wk is the key weight matrix, which is used to map the input data to the key vector space. The weight of each row represents a specific key vector, which is used to describe the input data at each position. The key vector is used together with the query vector to calculate the attention score to determine the association between different positions; Wv is the value weight matrix, which is used to map the input data to the value vector space; the weight of each row represents a specific value vector, which contains the information of the position and is used to generate the final output; the value vector is weighted according to the attention score to generate the output of the self-attention layer.

[0015] As a preferred embodiment of the prediction method of the type-II fuzzy neural network model based on the optimized whale algorithm described in the present invention, the type-II fuzzy neural network model includes calculating queries, keys and values, and calculating the query matrix Q, the key matrix K and the value matrix V respectively by multiplying the input feature matrix X with the query weight Wq, the key weight Wk and the value weight Wv. The size of the matrix is ​​[batchSize, inputSize], and the calculation formula is as follows:

[0016] Q=X*Wq

[0017] K=X*Wk

[0018] V=X*Wv

[0019] Among them, Q is the query vector, which is an abstract representation of the current position or current element; K is the key vector, which is used to match the query with other elements. It is obtained from the input sequence through linear transformation. The role of the key vector is to provide a representation vector of the input element for comparison with the query vector.

[0020] As a preferred embodiment of the prediction method of the type-II fuzzy neural network model based on the optimized whale algorithm described in the present invention, the type-II fuzzy neural network model includes calculating the attention score by multiplying the query matrix Q by the key matrix K element by element, and then operating a scaling factor, which is usually the square root of the feature dimension, to generate a matrix of size [batchSize, batchSize], in which each element represents the attention score of a different position, and the specific formula is as follows:

[0021]

[0022] Among them, AttentionScores(i,j) represents the attention scores of the i-th position and the j-th position, Q(i) represents the component of the query vector at the i-th position, K(j) represents the component of the key vector at the j-th position, and d represents the scaling factor, that is, the square root of the feature dimension.

[0023] As a preferred solution of the prediction method of the type-II fuzzy neural network model based on the optimized whale algorithm described in the present invention, wherein: the type-II fuzzy neural network model includes applying Softmax, applying the Softmax operation to the attention score matrix, normalizing the score to a probability distribution, so that the attention weight of each position is between 0 and 1, and their sum is equal to 1, ensuring the importance weight of each position, and the specific formula is as follows:

[0024]

[0025] Among them, Softmax(x)i represents the i-th element of the probability distribution after the Softmax operation, x i represents the i-th element of the input vector, and n represents the length of the vector.

[0026] As a preferred solution of the prediction method of the type-II fuzzy neural network model based on the optimized whale algorithm described in the present invention, the type-II fuzzy neural network model also includes multiplying the attention weight matrix obtained after the Softmax operation with the value matrix V, and then summing the weighted values ​​of all positions to generate an output matrix Z, wherein the value of each position is a weighted combination of the input features after the self-attention mechanism, and the specific formula is as follows:

[0027]

[0028] Among them, Output(i) represents the i-th element of the output vector, Softmax(x) j represents the j-th element in the attention score of the Softmax operation, and V(j) represents the j-th element in the value vector.

[0029] As a preferred embodiment of the prediction method of the type-II fuzzy neural network model based on the optimized whale algorithm described in the present invention, the type-II fuzzy neural network model further comprises: in the type-II fuzzy mapping layer, the input data is fuzzified for use in fuzzy reasoning, the current layer uses a Gaussian membership function to fuzzify the input data, each input dimension is associated with one or more fuzzy sets, and the characteristics of the fuzzy sets are parameterized by the Gaussian membership function, so that the processed input data passed in by the attention mechanism layer can be more fully expressed in the fuzzy category;

[0030] Among them, the Gaussian membership function is a mathematical function used to describe how the fuzzy set is associated with the actual input value. The general form is as follows:

[0031]

[0032] Among them, x represents the value of the input data, c represents the center of the fuzzy set, that is, the central position of the fuzzy set, and σ represents the standard deviation of the fuzzy set, which is used to control the width of the fuzzy set;

[0033] In the type-2 fuzzy mapping layer, each input dimension is fuzzified with one or more such Gaussian membership functions. In order to transform the input data from precise values ​​to values ​​in the fuzzy domain, the fuzzification process of the type-2 fuzzy mapping layer is as follows:

[0034] For each input dimension X, calculate the upper and lower bound values ​​of the Gaussian membership function associated with each fuzzy set;

[0035] Associate each input dimension of the input data with two fuzzy sets and calculate the upper and lower bounds of the Gaussian membership function under different dimensions;

[0036] The output of the second-type fuzzy mapping layer is as follows:

[0037]

[0038] in, represents k two-type fuzzy partitions, and Values ​​representing the upper and lower bounds of the Gaussian membership function.

[0039] As a preferred solution of the prediction method of the type-II fuzzy neural network model based on the optimized whale algorithm described in the present invention, wherein: the type-II fuzzy neural network model also includes:

[0040] In the rule triggering layer, by using the information in the rule list rule_list to determine which rule will be triggered, a layer determines the rules used in the fuzzy reasoning process to calculate the weight of the output. The process of rule triggering is as follows:

[0041] Confirm the structure of the rule list rule_list: The rule list is a matrix structure, each row of which represents a rule, each column corresponds to an input dimension, and each element of the rule list is represented by the following numerical values: 1 represents the selection of the first fuzzy set associated with the input dimension; 2 represents the selection of the second fuzzy set associated with the input dimension;

[0042] If rule_list(i,j)=1, then rule i will use the first fuzzy set associated with the jth input dimension;

[0043] In order to determine which rule will be triggered, it is necessary to check the rule entries in each rule and select the corresponding fuzzy set based on the input data;

[0044] For rule i, check the value of rule_list(i,j), where j is the index of the input dimension;

[0045] If rule_list(i,j)=1, the first fuzzy set associated with the j-th input dimension is selected; if rule_list(i,j)=2, the second fuzzy set associated with the j-th input dimension is selected;

[0046] The output of the mth node in the rule triggering layer is as follows:

[0047]

[0048] in, represents k two-type fuzzy partitions, ki Represents the i-th rule in the rule list;

[0049] Once the fuzzy set to be used is determined, the weight of the rule can be calculated. The upper and lower bound weights of the rule can be obtained by multiplying the membership values ​​of the fuzzy set of each dimension;

[0050] The calculation formula of the upper bound weight of the rule is as follows:

[0051]

[0052] The formula for calculating the lower bound weight of a rule is as follows:

[0053]

[0054] Where n represents the number of input dimensions, and They respectively represent the function membership values ​​of the upper and lower bounds of the fuzzy set selected by the j-th input dimension.

[0055] As a preferred solution of the prediction method of the type-II fuzzy neural network model based on the optimized whale algorithm described in the present invention, wherein: the type-II fuzzy neural network model also includes: the fuzzy reduction layer is a key component of the fuzzy neural network, and has M nodes. The task of each node is to convert the output transmitted from the rule trigger layer to generate a type-I fuzzy set. The purpose of the type-I fuzzy set is to interact with the consequent set parameters in the subsequent fuzzy reasoning process to achieve more advanced reasoning operations; the main steps of the fuzzy reduction are as follows:

[0056] Calculation of the difference weight (delt_ω), delt_ω represents the difference between the upper bound weight and the lower bound weight of each rule. The difference is used for subsequent average weight calculation. For each rule i, the calculation formula is as follows:

[0057] delt_ω(i)=ω max (i)-ω min (i)

[0058] Among them, delt_ω(i) represents the difference between the upper bound weight and the lower bound weight of the rule, ω max (i) and ω min (i) represents the upper and lower weights of the rule;

[0059] Calculate the average weight (ω_av): ω_av is the average weight, which is adjusted by introducing the parameter alfa. For each rule i, the calculation formula is as follows:

[0060] ω_av(i)=ω min(i)+alfa*delt_ω(i)

[0061] Among them, ω min (i) represents the lower bound weight, delt_ω(i) represents the difference between the upper bound weight and the lower bound weight of the rule, and alfa represents the parameter that controls the adjustment range of the weight;

[0062] The subsequent collection layer contains a total of M nodes, and its function is to fuse the output from the previous layer according to a given linear function. The steps of the subsequent collection layer are as follows:

[0063] When training a fuzzy neural network, the weight parameters are estimated by the least squares method. The goal is to fit the model by adjusting the weight parameters to accurately map the input to the target output. The weight parameters are estimated by minimizing the sum of squared errors, as shown below:

[0064] CC=argmin||BA*CC||^2

[0065] Among them, CC represents a column vector, which contains the parameters to be estimated, usually representing the weight parameters of the model, argmin represents finding CC that can minimize the expression, and represents the parameters that minimize the error; B represents a column vector, which contains the value of the actual target output, A represents a matrix, which contains the fuzzy representation of the input data, each row corresponds to a sample, and each column corresponds to a feature. A*CC represents the output of the model, that is, the fuzzy output obtained by linearly transforming the input data using the parameter CC, BA*CC represents the error between the actual target output and the model output, that is, the residual vector, and ||BA*CC||^2 represents the sum of squares of the errors, that is, the square of the Euclidean distance between the target output B and the model output A*CC;

[0066] Perform a linear transformation of the model. When using the model for prediction or fuzzy reasoning, use the determined optimal weight parameter CC to map the fuzzified input data to the output of the model. The transformation formula is as follows:

[0067] f=CC*xx

[0068] Among them, f represents the output of the model, which is a linear function, CC represents the optimal weight parameter obtained after training, and xx represents the vector of input data, including a constant term and the fuzzified input value;

[0069] The generated linear function is combined with the previous output weights to obtain the final output. The specific steps are as follows:

[0070] Perform data fusion and fuse the generated linear function with the output weight from the previous step. The specific formula is as follows:

[0071]

[0072] Among them, ω_av(m) represents the average weight at the mth node, f m represents the linear function of the linear transformation at the mth node,

[0073] Calculate the final result output, the formula is as follows:

[0074]

[0075] As a preferred solution of the prediction method of the type-two fuzzy neural network model based on the optimized whale algorithm described in the present invention, wherein: the population evolution strategy of the optimized whale algorithm is an important link in the algorithm process, and the evolution strategies corresponding to different sub-populations are different, specifically including exploratory sub-populations, development sub-populations and moderate sub-populations;

[0076] The exploratory subpopulation includes: the individuals of the exploratory subpopulation expand the search range, and enhance the global exploration ability by increasing the absolute value of the position vector. The position update adopts a random scaling method to randomly scale the individual position in the search space. The specific formula is as follows:

[0077] r1=rand(0,1)+1

[0078] X(t+1)=X(t)*r1

[0079] Where r1 represents a random number between 1 and 2, and t represents the number of iterations; if the current position is a local optimal solution, X(t+1)=X(t)*r1 can help the individual escape from the local optimal solution with a given probability. Under this effect, the absolute value of the current position vector increases, allowing the individual to explore other areas away from the current position. After that, the algorithm can search other areas;

[0080] The development subpopulation includes individuals in the exploitation subpopulation that evolve positions by conducting in-depth local searches around the current optimal solution. The position update depends on the position of the leader. The specific formula is as follows:

[0081] X(t+1)=X * (t)*r2

[0082] Among them, r2 represents a random number between 0 and 2, and X * (t) is the position vector of the current optimal solution. The individual positions in the development subpopulation are replaced by the increase or decrease of the position vector of the current optimal solution, thereby realizing the search in the surrounding area of ​​the current optimal solution.

[0083] The position update strategy of the moderate subpopulation includes two cases, one is the position update relative to the leader's position, and the other is the update according to the leader's position; in the first case, the individual position will be updated to the position relative to the leader's position; in the second case, the individual position will be updated according to the leader's position, and the specific formula is as follows:

[0084] X(t) new =lb+ub-X(t)

[0085] X(t+)=if X(t) new )better than fit(X(t)?X(t) new :X(t)

[0086] Among them, lb represents the lower bound of the problem space, ub represents the upper bound of the problem space, fit represents the objective function, and X(t) new Indicates the new location explored;

[0087] The position update strategy is an important part of the algorithm process. Different sub-populations have different corresponding position update strategies. The specific steps are as follows:

[0088] The exploratory subpopulation adopts a random leader position to update the position to increase diversity, and a random vector is used to increase the randomness of the position update. The specific formula is as follows:

[0089] A=2*a*r1-a

[0090] D=|2*rand(0,1)*X ran (t)-X(t)|

[0091] X(t+1)=X ran (t)-A*D

[0092] Among them, X ran (t) represents a random whale in the population in the current iteration number, D represents the absolute value of the difference between the individual position and the random leader position, t represents the iteration number, a represents a dynamic number calculated according to the iteration number, and r1 represents a random number between 0 and 1;

[0093] The development subpopulation can select different position update strategies according to the random probability p. If p is greater than or equal to 0.5, it will focus more on local search and use the position update strategy relative to the leader position; otherwise, it will adopt the local search strategy and use the leader position for position update. The specific formula is as follows:

[0094]

[0095] Among them, p represents the random probability, which is used to determine the location update strategy, X * (t) is the position vector of the current optimal solution, A represents a dynamic number generated according to the number of iterations and random number calculations, and b and l represent parameters used to control position changes.

[0096] The specific formula for the fitness of the moderate subpopulation is as follows:

[0097]

[0098] Among them, p and p1 represent two random probabilities between 0 and 1.

[0099] Beneficial effects of the invention: The present invention provides a prediction method for a type-2 fuzzy neural network model based on an optimized whale algorithm. The present invention defines a type-2 fuzzy neural network model, which is composed of n input variables, one output variable and k rules. As shown in the figure below, the type-2 fuzzy neural network model is a neural network model structure composed of an attention mechanism layer, a type-2 fuzzy mapping layer, a rule trigger layer, a fuzzy reduction layer, a consequent set layer and a result output layer. The present invention proposes an optimized whale algorithm to optimize the search performance of the antecedent and consequent parameters in the type-2 fuzzy neural network model. The optimized whale algorithm adopts a strategy of simultaneous evolution of multiple populations, which can improve population diversity and enhance global search capabilities, and has a great improvement in parameter identification and search in the type-2 fuzzy neural network model. BRIEF DESCRIPTION OF THE DRAWINGS

[0100] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.

[0101] Figure 1 A structural diagram of a type-two fuzzy neural network model of a prediction method of a type-two fuzzy neural network model based on an optimized whale algorithm provided by an embodiment of the present invention.

[0102] Figure 2 An optimized whale algorithm flow chart of a prediction method for a type-2 fuzzy neural network model based on an optimized whale algorithm provided in one embodiment of the present invention.

[0103] Figure 3 An optimized whale algorithm Mackey-Glass time series prediction graph of a prediction method of a type-two fuzzy neural network model based on an optimized whale algorithm provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0104] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.

[0105] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.

[0106] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.

[0107] The present invention is described in detail with reference to schematic diagrams. When describing the embodiments of the present invention, for the sake of convenience, the cross-sectional diagrams showing the device structure will not be partially enlarged according to the general scale, and the schematic diagrams are only examples, which should not limit the scope of protection of the present invention. In addition, in actual production, the three-dimensional dimensions of length, width and depth should be included.

[0108] At the same time, in the description of the present invention, it should be noted that the directions or positional relationships indicated by the terms "upper, lower, inner and outer" are based on the directions or positional relationships shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore cannot be understood as limiting the present invention. In addition, the terms "first, second or third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.

[0109] In the present invention, unless otherwise clearly specified and limited, the terms "install, connect, connect" should be understood in a broad sense, for example: it can be a fixed connection, a detachable connection or an integral connection; it can also be a mechanical connection, an electrical connection or a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0110] Example 1

[0111] Reference Figure 1, which is the first embodiment of the present invention, provides a prediction method of a type-II fuzzy neural network model based on an optimized whale algorithm, comprising:

[0112] S1: Collect training data and preprocess the data.

[0113] S2: Construct a type-2 fuzzy neural network model based on the preprocessed data.

[0114] The type-II fuzzy neural network model includes an attention mechanism layer that allows the type-II fuzzy neural network model to allocate attention weights at different positions according to the specific content of the input when processing sequence data;

[0115] The attention mechanism layer processes data including the input feature matrix X. The input parameter of the type-II fuzzy neural network model is a two-dimensional matrix with a size of [batchSize, inputSize], where batchSize represents the batch size and inputSize represents the dimension of the feature.

[0116] Initialize the learning parameters, including the weight matrices Wq, Wk, and Wv of the query Q, key K, and value V. The weight matrix is ​​used to map the input features to the query, key, and value space, where:

[0117] Wq=randn(inputSize,inputSize)

[0118] Wk=randn(inputSize,inputSize)

[0119] Wv=randn(inputSize,inputSize)

[0120] Wq, Wk and Wv are used to linearly transform the input data and project the input data into the space of query Q, key K and value V, where Wq is the query weight matrix, which is used to map the input data to the query vector space. The weight of each row represents a specific query vector, which is used to measure the importance of the input data at each position to other positions; Wk is the key weight matrix, which is used to map the input data to the key vector space. The weight of each row represents a specific key vector, which is used to describe the input data at each position. The key vector is used together with the query vector to calculate the attention score to determine the association between different positions; Wv is the value weight matrix, which is used to map the input data to the value vector space; the weight of each row represents a specific value vector, which contains the information of the position and is used to generate the final output; the value vector is weighted according to the attention score to generate the output of the self-attention layer.

[0121] The type-II fuzzy neural network model includes calculating queries, keys and values ​​by multiplying the input feature matrix X with the query weight Wq, key weight Wk and value weight Wv to calculate the query matrix Q, key matrix K and value matrix V respectively. The size of the matrix is ​​[batchSize, inputSize], and the calculation formula is as follows:

[0122] Q=X*Wq

[0123] K=X*Wk

[0124] V=X*Wv

[0125] Among them, Q is the query vector, which is an abstract representation of the current position or current element; K is the key vector, which is used to match the query with other elements. It is obtained from the input sequence through linear transformation. The role of the key vector is to provide a representation vector of the input element for comparison with the query vector.

[0126] The type-II fuzzy neural network model includes calculating the attention score by multiplying the query matrix Q by the key matrix K element by element, and then operating a scaling factor, usually the square root of the feature dimension, to generate a matrix of size [batchSize, batchSize], where each element represents the attention score of a different position. The specific formula is as follows:

[0127]

[0128] Among them, AttentionScores(i,j) represents the attention scores of the i-th position and the j-th position, Q(i) represents the component of the query vector at the i-th position, K(j) represents the component of the key vector at the j-th position, and d represents the scaling factor, that is, the square root of the feature dimension.

[0129] The type-II fuzzy neural network model includes applying Softmax, applying a Softmax operation to the attention score matrix, normalizing the scores to a probability distribution, so that the attention weight of each position is between 0 and 1, and their sum is equal to 1, ensuring the importance weight of each position. The specific formula is as follows:

[0130]

[0131] Among them, Softmax(x) i represents the i-th element of the probability distribution after the Softmax operation, x i represents the i-th element of the input vector, and n represents the length of the vector.

[0132] The type-II fuzzy neural network model also includes multiplying the attention weight matrix obtained after the Softmax operation with the value matrix V, and then summing the weighted values ​​of all positions to generate an output matrix Z, where the value of each position is a weighted combination of the input features after the self-attention mechanism. The specific formula is as follows:

[0133]

[0134] Among them, Output(i) represents the i-th element of the output vector, Softmax(x) j represents the j-th element in the attention score of the Softmax operation, and V(j) represents the j-th element in the value vector.

[0135] The type-II fuzzy neural network model also includes: in the type-II fuzzy mapping layer, input data is fuzzified for use in fuzzy reasoning, the current layer uses a Gaussian membership function to fuzzify the input data, each input dimension is associated with one or more fuzzy sets, and the characteristics of the fuzzy sets are parameterized by the Gaussian membership function, so that the processed input data passed by the attention mechanism layer can be more fully expressed in the fuzzy category;

[0136] Among them, the Gaussian membership function is a mathematical function used to describe how the fuzzy set is associated with the actual input value. The general form is as follows:

[0137]

[0138] Among them, x represents the value of the input data, c represents the center of the fuzzy set, that is, the central position of the fuzzy set, and σ represents the standard deviation of the fuzzy set, which is used to control the width of the fuzzy set;

[0139] In the type-2 fuzzy mapping layer, each input dimension is fuzzified with one or more such Gaussian membership functions. In order to transform the input data from precise values ​​to values ​​in the fuzzy domain, the fuzzification process of the type-2 fuzzy mapping layer is as follows:

[0140] For each input dimension X, calculate the upper and lower bound values ​​of the Gaussian membership function associated with each fuzzy set;

[0141] Associate each input dimension of the input data with two fuzzy sets and calculate the upper and lower bounds of the Gaussian membership function under different dimensions;

[0142] The output of the second-type fuzzy mapping layer is as follows:

[0143]

[0144] in, represents k two-type fuzzy partitions, and Values ​​representing the upper and lower bounds of the Gaussian membership function.

[0145] In the rule triggering layer, by using the information in the rule list rule_list to determine which rule will be triggered, a layer determines the rules used in the fuzzy reasoning process to calculate the weight of the output. The process of rule triggering is as follows:

[0146] Confirm the structure of the rule list rule_list: The rule list is a matrix structure, each row of which represents a rule, each column corresponds to an input dimension, and each element of the rule list is represented by the following numerical values: 1 represents the selection of the first fuzzy set associated with the input dimension; 2 represents the selection of the second fuzzy set associated with the input dimension;

[0147] If rule_list(i,j)=1, then rule i will use the first fuzzy set associated with the jth input dimension;

[0148] In order to determine which rule will be triggered, it is necessary to check the rule entries in each rule and select the corresponding fuzzy set based on the input data;

[0149] For rule i, check the value of rule_list(i,j), where j is the index of the input dimension;

[0150] If rule_list(i,j)=1, the first fuzzy set associated with the j-th input dimension is selected; if rule_list(i,j)=2, the second fuzzy set associated with the j-th input dimension is selected;

[0151] The output of the mth node in the rule triggering layer is as follows:

[0152]

[0153] in, represents k two-type fuzzy partitions, k i Represents the i-th rule in the rule list;

[0154] Once the fuzzy set to be used is determined, the weight of the rule can be calculated. The upper and lower bound weights of the rule can be obtained by multiplying the membership values ​​of the fuzzy set of each dimension;

[0155] The calculation formula of the upper bound weight of the rule is as follows:

[0156]

[0157] The formula for calculating the lower bound weight of a rule is as follows:

[0158]

[0159] Where n represents the number of input dimensions, and They respectively represent the function membership values ​​of the upper and lower bounds of the fuzzy set selected by the j-th input dimension.

[0160] The type II fuzzy neural network model also includes: the fuzzy reduction layer is a key component of the fuzzy neural network, and has M nodes. The task of each node is to convert the output transmitted from the rule trigger layer to generate a type I fuzzy set. The purpose of the type I fuzzy set is to interact with the consequent set parameters in the subsequent fuzzy reasoning process to achieve more advanced reasoning operations; the main steps of fuzzy reduction are as follows:

[0161] Calculation of the difference weight (delt_ω), delt_ω represents the difference between the upper bound weight and the lower bound weight of each rule. The difference is used for subsequent average weight calculation. For each rule i, the calculation formula is as follows:

[0162] delt_ω(i)=ω max (i)-ω min (i)

[0163] Among them, delt_ω(i) represents the difference between the upper bound weight and the lower bound weight of the rule, ω max (i) and ω min (i) represents the upper and lower weights of the rule;

[0164] Calculate the average weight (ω_av): ω_av is the average weight, which is adjusted by introducing the parameter alfa. For each rule i, the calculation formula is as follows:

[0165] ω_av(i)=ω min (i)+alfa*delt_ω(i)

[0166] Among them, ω min (i) represents the lower bound weight, delt_ω(i) represents the difference between the upper bound weight and the lower bound weight of the rule, and alfa represents the parameter that controls the adjustment range of the weight;

[0167] The subsequent collection layer contains a total of M nodes, and its function is to fuse the output from the previous layer according to a given linear function. The steps of the subsequent collection layer are as follows:

[0168] When training a fuzzy neural network, the weight parameters are estimated by the least squares method. The goal is to fit the model by adjusting the weight parameters to accurately map the input to the target output. The weight parameters are estimated by minimizing the sum of squared errors, as shown below:

[0169] CC=argmin||BA*CC||^2

[0170] Among them, CC represents a column vector, which contains the parameters to be estimated, usually representing the weight parameters of the model, argmin represents finding CC that can minimize the expression, and represents the parameters that minimize the error; B represents a column vector, which contains the value of the actual target output, A represents a matrix, which contains the fuzzy representation of the input data, each row corresponds to a sample, and each column corresponds to a feature. A*CC represents the output of the model, that is, the fuzzy output obtained by linearly transforming the input data using the parameter CC, BA*CC represents the error between the actual target output and the model output, that is, the residual vector, and ||BA*CC||^2 represents the sum of squares of the errors, that is, the square of the Euclidean distance between the target output B and the model output A*CC;

[0171] Perform a linear transformation of the model. When using the model for prediction or fuzzy reasoning, use the determined optimal weight parameter CC to map the fuzzified input data to the output of the model. The transformation formula is as follows:

[0172] f=CC*xx

[0173] Among them, f represents the output of the model, which is a linear function, CC represents the optimal weight parameter obtained after training, and xx represents the vector of input data, including a constant term and the fuzzified input value;

[0174] The generated linear function is combined with the previous output weights to obtain the final output. The specific steps are as follows:

[0175] Perform data fusion and fuse the generated linear function with the output weight from the previous step. The specific formula is as follows:

[0176]

[0177] Among them, ω_av(m) represents the average weight at the mth node, f m represents the linear function of the linear transformation at the mth node,

[0178] Calculate the final result output, the formula is as follows:

[0179]

[0180] S3: Introduce the strategy of simultaneously evolving multiple populations, introduce the information interaction mechanism between populations, and optimize the whale algorithm.

[0181] The population evolution strategy of the optimized whale algorithm is an important part of the algorithm process. Different sub-populations have different corresponding evolution strategies, including exploratory sub-populations, development sub-populations and moderate sub-populations.

[0182] The exploratory subpopulation includes: the individuals of the exploratory subpopulation expand the search range, and enhance the global exploration ability by increasing the absolute value of the position vector. The position update adopts a random scaling method to randomly scale the individual position in the search space. The specific formula is as follows:

[0183] r1=rand(0,1)+1

[0184] X(t+1)=X(t)*r1

[0185] Where r1 represents a random number between 1 and 2, and t represents the number of iterations; if the current position is a local optimal solution, X(t+1)=X(t)*r1 can help the individual escape from the local optimal solution with a given probability. Under this effect, the absolute value of the current position vector increases, allowing the individual to explore other areas away from the current position. After that, the algorithm can search other areas;

[0186] The development subpopulation includes individuals in the exploitation subpopulation that evolve positions by conducting in-depth local searches around the current optimal solution. The position update depends on the position of the leader. The specific formula is as follows:

[0187] X(t+1)=X * (t)*r2

[0188] Among them, r2 represents a random number between 0 and 2, and X * (t) is the position vector of the current optimal solution. The individual positions in the development subpopulation are replaced by the increase or decrease of the position vector of the current optimal solution, thereby realizing the search in the surrounding area of ​​the current optimal solution.

[0189] The position update strategy of the moderate subpopulation includes two cases, one is the position update relative to the leader's position, and the other is the update according to the leader's position; in the first case, the individual position will be updated to the position relative to the leader's position; in the second case, the individual position will be updated according to the leader's position, and the specific formula is as follows:

[0190] X(t) new =lb+ub-X(t)

[0191] X(t+)=if X(t) new )better than fit(X(t)?X(t) new :X(t)

[0192] Among them, lb represents the lower bound of the problem space, ub represents the upper bound of the problem space, fit represents the objective function, and X(t) new Indicates the new location explored;

[0193] The position update strategy is an important part of the algorithm process. Different sub-populations have different corresponding position update strategies. The specific steps are as follows:

[0194] The exploratory subpopulation adopts a random leader position to update the position to increase diversity, and a random vector is used to increase the randomness of the position update. The specific formula is as follows:

[0195] A=2*a*r1-a

[0196] D=|2*rand(0,1)*X ran (t)-X(t)|

[0197] X(t+1)=X ran (t)-A*D

[0198] Among them, X ran (t) represents a random whale in the population in the current iteration number, D represents the absolute value of the difference between the individual position and the random leader position, t represents the iteration number, a represents a dynamic number calculated according to the iteration number, and r1 represents a random number between 0 and 1;

[0199] The development subpopulation can select different position update strategies according to the random probability p. If p is greater than or equal to 0.5, it will focus more on local search and use the position update strategy relative to the leader position; otherwise, it will adopt the local search strategy and use the leader position for position update. The specific formula is as follows:

[0200]

[0201] Among them, p represents the random probability, which is used to determine the location update strategy, X * (t) is the position vector of the current optimal solution, A represents a dynamic number generated according to the number of iterations and random number calculations, and b and l represent parameters used to control position changes.

[0202] The specific formula for the fitness of the moderate subpopulation is as follows:

[0203]

[0204] Among them, p and p1 represent two random probabilities between 0 and 1.

[0205] Example 2

[0206] Reference Figure 1-Figure 3 As an embodiment of the present invention, a prediction method of a type-II fuzzy neural network model based on an optimized whale algorithm is provided. In order to verify the beneficial effects of the present invention, scientific demonstration is carried out through experiments.

[0207] Step 1: Optimize the initialization of whale algorithm parameters. Introduce adaptive strategy parameters: explorationRate, which represents the exploration rate parameter; exploitationRate, which represents the utilization rate parameter. During the optimization process, an adaptive strategy is used to gradually reduce the exploration rate and gradually increase the utilization rate to improve the performance of the algorithm. This shows that the algorithm is more inclined to explore the solution space in the early stage and more inclined to use known information in the later stage. After each iteration, explorationRate needs to be multiplied by the exploration rate reduction parameter between [0.95, 1] ​​to achieve a decrease in the exploration rate, and exploitationRate needs to be multiplied by the utilization rate increase parameter between [1, 1.05] to achieve an increase in the utilization rate.

[0208] Step 2: Introduce local search strategy parameters: localSearchRate, which indicates the local search probability; localSearchRadius, which indicates the local search radius. During the position update process of each individual, the value of the local search probability determines whether to perform a local search. If a local search is performed, a new position will be randomly generated within a small radius, and the individual's position and fitness will be updated. This helps the algorithm better explore the local optimal solution.

[0209] Step 3: Divide the population into three different sub-populations:

[0210] Exploration subpopulation: The main task is to explore the search space and find potential global optimal solutions. The exploration subpopulation tends to adopt a more random search strategy to search extensively in the search space. Its goal is to improve the diversity of the algorithm, explore every corner of the search space, and avoid falling into the local optimal solution. Therefore, the main responsibility of the exploration subpopulation is to conduct global search.

[0211] Exploitation subpopulation: After finding a potential solution, the exploration subpopulation focuses more on local search to improve accuracy. This subpopulation adopts a more localized search strategy to optimize the already found solution to obtain higher accuracy. The task of the development subpopulation is to make full use of known information to find better solutions.

[0212] Moderate subpopulation: After exploring the entire global space, the moderate subpopulation will focus more on local search and robust improvement. They tend to adopt a more balanced strategy, but with a certain degree of randomness. The goal of this subpopulation is to improve the performance of the algorithm by finding more accurate solutions in local areas.

[0213] Step 4: Exploratory subpopulation population evolution. The individuals in the exploratory subpopulation expand their search range and enhance the global exploration ability by increasing the absolute value of the position vector. The position update adopts a random scaling method, which will randomly scale the individual position in the search space and increase diversity. The specific formula is as follows:

[0214] r1=rand(0,1)+1

[0215] X(t+1)=X(t)*r1

[0216] Where r1 is a random number between 1 and 2, and t is the number of iterations. If the current position is a local optimal solution, X(t+1)=X(t)*r1 can help the individual escape from the local optimal solution with a certain probability, because under its action, the absolute value of the current position vector increases, allowing the individual to explore other areas away from the current position. After that, the algorithm can search other areas, making the global exploration capability more powerful.

[0217] Step 5: Exploitation subpopulation population evolution. The individuals in the exploitation subpopulation evolve their positions by conducting in-depth local searches around the current optimal solution, and the position update depends on the position of the leader. The specific formula is as follows:

[0218] X(t+1)=X * (t)*r2

[0219] Among them, r2 represents a random number between 0 and 2, and X * (t) is the position vector of the current optimal solution. The individual positions in the development subpopulation are replaced by the increase or decrease of the position vector of the current optimal solution, thereby realizing the search in the surrounding area of ​​the current optimal solution. This evolutionary strategy can make full use of the position information of the current optimal solution, accelerate convergence and improve the accuracy of the solution.

[0220] Step 6: Moderate subpopulation population evolution. The position update strategy of the moderate subpopulation includes two cases: one is the position update relative to the leader's position, and the other is the update based on the leader's position. In the first case, the individual position will be updated to the relative position of the leader; in the second case, the individual position will be updated based on the leader's position. The specific formula is as follows:

[0221] X(t) new =lb+ub-X(t)

[0222] X(t+)=if X(t) new )better than fit(X(t)?X(t) new :X(t)

[0223] Among them, lb represents the lower bound of the problem space, ub represents the upper bound of the problem space, fit represents the objective function, and X(t) new Indicates a new location explored.

[0224] Step 7: Exploratory subpopulation position update. Use random leader positions to update positions to increase diversity. Use a random vector to increase the randomness of position updates. This method is used in the global search phase to help the algorithm explore more extensively in the search space. The specific formula is as follows:

[0225] X(t+1)=X ran (t)-A*D

[0226] Among them, X ran (t) represents a random whale in the population in the current iteration number, D represents the absolute value of the difference between the individual position and the random leader position, t represents the iteration number, a represents a dynamic number calculated according to the iteration number, and r1 represents a random number between 0 and 1.

[0227] Step 8: Developing subpopulation position update. According to the random probability p, it can choose different position update strategies. If p is greater than or equal to 0.5, it will focus more on local search and use the position update strategy relative to the leader position. Otherwise, it will adopt the local search strategy and use the leader position for position update. The specific formula is as follows:

[0228]

[0229] Among them, p represents the random probability, which is used to determine the location update strategy, X * (t) is the position vector of the current optimal solution, A represents a dynamic number generated according to the number of iterations and random number calculations, and b and l represent parameters used to control position changes.

[0230] Step 9: Update the position of the moderate subpopulation. The fitness of the moderate subpopulation is between good and bad. Therefore, the moderate subpopulation either explores to find new solutions or develops locally to increase the convergence speed, thereby achieving a random balance between exploration and exploitation. The specific formula is as follows:

[0231]

[0232] Among them, p and p1 represent two random probabilities between 0 and 1.

[0233] Step 10: The parameters obtained after optimization by the whale algorithm are retained and used in the type-2 fuzzy neural network model. The feature matrix X is input into the type-2 fuzzy neural network model. The input parameter of the type-2 fuzzy neural network model is a two-dimensional matrix with a size of [batchSize, inputSize], where batchSize represents the batch size and inputSize represents the dimension of the feature.

[0234] Step 11: Parameter initialization. Initialize the learning parameters, including the weight matrices Wq, Wk, and Wv of the query (Q), key (K), and value (V). These weight matrices are used to map the input features to the query, key, and value spaces.

[0235] in:

[0236] Wq=randn(inputSize,inputSize)

[0237] Wk=randn(inputSize,inputSize)

[0238] Wv=randn(inputSize,inputSize)

[0239] Wq, Wk, and Wv are used to linearly transform the input data and project the input data into the space of query (Q), key (K), and value (V). Where Wq is the query weight matrix, which is used to map the input data to the query vector space. The weight of each row represents a specific query vector, which is used to measure the importance of the input data at each position to other positions. Wk is the key weight matrix, which is used to map the input data to the key vector space. Similar to the query vector, the weight of each row represents a specific key vector, which is used to describe the input data at each position. The key vector is used together with the query vector to calculate the attention score to determine the association between different positions. Wv is the value weight matrix, which is used to map the input data to the value vector space. The weight of each row represents a specific value vector, which contains the information of the position and is used to generate the final output. The value vector is weighted according to the attention score to generate the output of the self-attention layer.

[0240] Step 12: Calculate query, key and value: Calculate the query matrix Q, key matrix K and value matrix V by multiplying the input feature matrix X with the query weight Wq, key weight Wk and value weight Wv respectively. The size of these matrices is [batchSize, inputSize]. The calculation formula is as follows:

[0241] Q=X*Wq

[0242] K=X*Wk

[0243] V=X*Wv

[0244] Q is the query vector, which is an abstract representation of the current position or current element. K is the key vector, which is used to match queries with other elements. It is obtained from the input sequence through linear transformation. The role of the key vector is to provide a representation vector of the input element for comparison with the query vector.

[0245] Step 13: Calculate the attention score. This step is done by multiplying the query matrix Q by the key matrix K element by element, and then operating a scaling factor (usually the square root of the feature dimension). This will generate a matrix of size [batchSize, batchSize], where each element represents the attention score at a different position. The specific formula is as follows:

[0246]

[0247] Among them, AttentionScores(i,j) represents the attention scores of the i-th position and the j-th position, Q(i) represents the component of the query vector at the i-th position, K(j) represents the component of the key vector at the j-th position, and d represents the scaling factor, which is the square root of the feature dimension (usually the dimension of the query and key).

[0248] Step 14: Apply Softmax. Apply the Softmax operation to the attention score matrix to normalize the scores into a probability distribution so that the attention weight of each position is between 0 and 1, and their sum is equal to 1. This ensures the importance weight of each position. The specific formula is as follows:

[0249]

[0250] Among them, Softmax(x) i represents the i-th element of the probability distribution after the Softmax operation, x i represents the i-th element of the input vector, and n represents the length of the vector.

[0251] Step 15: Weighted summation. Multiply the attention weight matrix obtained after the Softmax operation with the value matrix V, and then sum the weighted values ​​of all positions to generate an output matrix Z, where the value of each position is the weighted combination of the input features after the self-attention mechanism. The specific formula is as follows:

[0252]

[0253] Among them, Output(i) represents the i-th element of the output vector, Softmax(x) j represents the j-th element in the attention score of the Softmax operation, and V(j) represents the j-th element in the value vector.

[0254] Step 16: For each input dimension X, calculate the upper and lower bound values ​​of the Gaussian membership function associated with each fuzzy set.

[0255] Step 17: Associate each input dimension of the input data with two fuzzy sets and calculate the upper and lower bounds of the Gaussian membership function under different dimensions.

[0256] The output of the type-two fuzzy mapping layer is as follows:

[0257]

[0258] in, represents k two-type fuzzy partitions, and Values ​​representing the upper and lower bounds of the Gaussian membership function.

[0259] Step 18: Step 1: Confirm the structure of the rule list (rule_list): The rule list is a matrix structure, each row represents a rule, and each column corresponds to an input dimension. Each element of the rule list is represented by the following numerical values:

[0260] 1: Indicates that the first fuzzy set associated with this input dimension is selected.

[0261] 2: Indicates that the second fuzzy set associated with this input dimension is selected.

[0262] If rule_list(i,j)=1, then rule i will use the first fuzzy set associated with the jth input dimension.

[0263] Step 19: Rule triggering. In order to determine which rule will be triggered, it is necessary to check the rule entries in each rule and select the corresponding fuzzy set based on the input data.

[0264] For rule i, check the value of rule_list(i,j), where j is the index into the input dimension.

[0265] If rule_list(i,j)=1, the first fuzzy set associated with the j-th input dimension is selected, and if rule_list(i,j)=2, the second fuzzy set associated with the j-th input dimension is selected.

[0266] The output of the mth node in the rule triggering layer is as follows:

[0267]

[0268] in, represents k two-type fuzzy partitions, k i Represents the i-th rule in the rule list.

[0269] Step 20: Weight calculation. Once the fuzzy set to be used is determined, the weight of the rule can be calculated. The upper and lower bound weights of the rule can be obtained by multiplying the membership values ​​of the fuzzy set of each dimension.

[0270] The calculation formula of the upper bound weight of the rule is as follows:

[0271]

[0272] The formula for calculating the lower bound weight of a rule is as follows:

[0273]

[0274] Where n represents the number of input dimensions, and They respectively represent the function membership values ​​of the upper and lower bounds of the fuzzy set selected by the j-th input dimension.

[0275] Step 21: Calculation of the fuzzy degraded layer difference weight (delt_ω). delt_ω represents the difference between the upper bound weight and the lower bound weight of each rule. This difference is used for subsequent average weight calculation. For each rule i, the calculation formula is as follows:

[0276] delt_ω(i)=ω max (i)-ω min (i)

[0277] Among them, delt_ω(i) represents the difference between the upper bound weight and the lower bound weight of the rule, ω max (i) and ω min (i) represents the upper and lower weights of the rule.

[0278] Step 22: Calculation of average weight (ω_av). ω_av is the average weight, which is adjusted by introducing parameter alfa. For each rule i, the calculation formula is as follows:

[0279] ω_av(i)=ω min (i)+alfa*delt_ω(i)

[0280] Among them, ω min (i) represents the lower bound weight, delt_ω(i) represents the difference between the upper bound weight and the lower bound weight of the rule, and alfa represents the parameter that controls the adjustment amplitude of the weight.

[0281] Step 23: Estimation of weight parameters of the consequent set layer. When training a fuzzy neural network, the weight parameters are first estimated by the least squares method. The goal is to fit the model by adjusting the weight parameters so that it can map the input to the target output as accurately as possible. This step estimates the weight parameters by minimizing the sum of squared errors, as shown below:

[0282] CC=argmin||BA*CC||^2

[0283] Among them, CC represents a column vector, which contains the parameters to be estimated, usually representing the weight parameters of the model. argmin means to find CC that can minimize the expression behind it, which represents the parameter that minimizes the error. B represents a column vector, which contains the value of the actual target output. A represents a matrix, which contains the fuzzy representation of the input data, each row corresponds to a sample, and each column corresponds to a feature. A*CC represents the output of the model, that is, the fuzzy output obtained by linearly transforming the input data using the parameters CC. BA*CC represents the error between the actual target output and the model output, that is, the residual vector. ||BA*CC||^2 represents the sum of squares of the error, that is, the square of the Euclidean distance between the target output B and the model output A*CC.

[0284] Step 24: Linear transformation of the model. When using the model for prediction or fuzzy reasoning, the optimal weight parameter CC that has been determined is used to map the fuzzified input data to the output of the model. This is achieved through the following linear transformation. The transformation formula is as follows:

[0285] f=CC*xx

[0286] Among them, f represents the output of the model, which is a linear function, CC represents the optimal weight parameter obtained after training, and xx represents the vector of input data, which includes a constant term and the fuzzified input value.

[0287] Step 25: Result output layer data fusion. The generated linear function is fused with the output weight from the previous step. The specific formula is as follows:

[0288]

[0289] Among them, ω_av(m) represents the average weight at the mth node, f m represents the linear function of the linear transformation at the mth node,

[0290] Step 26: Calculate the final result output. The formula is as follows:

[0291]

[0292] Step 27: Use the type-II fuzzy neural network model optimized by the optimized whale algorithm to predict the Mackey-Glass time series prediction background. The data prediction graph obtained is as follows: Figure 3 as shown.

[0293] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.

[0294] Example 3

[0295] The third embodiment of the present invention is different from the first two embodiments in that:

[0296] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.

[0297] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of complete hardware embodiments, complete software embodiments, or embodiments in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code. The scheme in the embodiments of the present application can be implemented in various computer languages, for example, object-oriented programming language Java and literal scripting language JavaScript, etc.

[0298] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0299] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0300] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0301] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0302] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A prediction method based on a type-II fuzzy neural network model with an optimized whale algorithm, characterized in that: include, Collecting training data and preprocessing the data; Construct a type-II fuzzy neural network model based on the preprocessed data; Introduce a strategy of simultaneously evolving multiple populations, introduce an information interaction mechanism between populations, and optimize the whale algorithm.

2. The prediction method of the type-II fuzzy neural network model based on the optimized whale algorithm as claimed in claim 1, characterized in that: The type-II fuzzy neural network model includes an attention mechanism layer that allows the type-II fuzzy neural network model to allocate attention weights at different positions according to the specific content of the input when processing sequence data; The attention mechanism layer processes data including the input feature matrix X. The input parameter of the type-II fuzzy neural network model is a two-dimensional matrix with a size of [batchSize, inputSize], where batchSize represents the batch size and inputSize represents the dimension of the feature. Initialize the learning parameters, including the weight matrices Wq, Wk, and Wv of the query Q, key K, and value V. The weight matrix is ​​used to map the input features to the query, key, and value space, where: Wq=randn(inputSize,inputSize) Wk=randn(inputSize,inputSize) Wv=randn(inputSize,inputSize) Wq, Wk, and Wv are used to linearly transform the input data and project the input data into the space of query Q, key K, and value V, where Wq is the query weight matrix, which is used to map the input data to the query vector space. The weight of each row represents a specific query vector, which is used to measure the importance of the input data at each position to other positions; Wk is the key weight matrix, which is used to map the input data to the key vector space. The weight of each row represents a specific key vector, which is used to describe the input data at each position. The key vector is used together with the query vector to calculate the attention score to determine the correlation between different positions; Wv is the value weight matrix, which is used to map the input data to the value vector space; the weight of each row represents a specific value vector, which contains the position information and is used to generate the final output; the value vector is weighted according to the attention score to generate the output of the self-attention layer.

3. The prediction method of the type-II fuzzy neural network model based on the optimized whale algorithm as claimed in claim 2, characterized in that: The type-II fuzzy neural network model includes calculating queries, keys and values ​​by multiplying the input feature matrix X with the query weight Wq, key weight Wk and value weight Wv to calculate the query matrix Q, key matrix K and value matrix V respectively. The size of the matrix is ​​[batchSize, inputSize], and the calculation formula is as follows: Q=X*Wq K=X*Wk V=X*Wv Among them, Q is the query vector, which is an abstract representation of the current position or current element; K is the key vector, which is used to match the query with other elements. It is obtained from the input sequence through linear transformation. The role of the key vector is to provide a representation vector of the input element for comparison with the query vector.

4. The prediction method of the type-II fuzzy neural network model based on the optimized whale algorithm as claimed in claim 3, characterized in that: The type-II fuzzy neural network model includes calculating the attention score by multiplying the query matrix Q by the key matrix K element by element, and then operating a scaling factor, usually the square root of the feature dimension, to generate a matrix of size [batchSize, batchSize], where each element represents the attention score of a different position. The specific formula is as follows: Among them, AttentionScores(i,j) represents the attention scores of the i-th position and the j-th position, Q(i) represents the component of the query vector at the i-th position, K(j) represents the component of the key vector at the j-th position, and d represents the scaling factor, that is, the square root of the feature dimension.

5. The prediction method of the type-II fuzzy neural network model based on the optimized whale algorithm as claimed in claim 4, characterized in that: The type-II fuzzy neural network model includes applying Softmax, applying the Softmax operation to the attention score matrix, normalizing the score to a probability distribution, so that the attention weight of each position is between 0 and 1, and the sum is equal to 1, ensuring the importance weight of each position. The specific formula is as follows: Among them, Softmax(x) i represents the i-th element of the probability distribution after the Softmax operation, x i represents the i-th element of the input vector, and n represents the length of the vector.

6. The prediction method of type II fuzzy neural network model based on optimized whale algorithm as claimed in claim 5, characterized in that: The type-II fuzzy neural network model also includes multiplying the attention weight matrix obtained after the Softmax operation with the value matrix V, and then summing the weighted values ​​of all positions to generate an output matrix Z, where the value of each position is a weighted combination of the input features after the self-attention mechanism. The specific formula is as follows: Among them, Output(i) represents the i-th element of the output vector, Softmax(x) j represents the j-th element in the attention score of the Softmax operation, and V(j) represents the j-th element in the value vector.

7. The prediction method of type II fuzzy neural network model based on optimized whale algorithm as claimed in claim 6, characterized in that: The type-II fuzzy neural network model also includes: in the type-II fuzzy mapping layer, input data is fuzzified for use in fuzzy reasoning, the current layer uses a Gaussian membership function to fuzzify the input data, each input dimension is associated with one or more fuzzy sets, and the characteristics of the fuzzy sets are parameterized by the Gaussian membership function, so that the processed input data passed by the attention mechanism layer can be more fully expressed in the fuzzy category; Among them, the Gaussian membership function is a mathematical function used to describe how the fuzzy set is associated with the actual input value. The general form is as follows: Among them, x represents the value of the input data, c represents the center of the fuzzy set, that is, the central position of the fuzzy set, and σ represents the standard deviation of the fuzzy set, which is used to control the width of the fuzzy set; In the type-2 fuzzy mapping layer, each input dimension is fuzzified with one or more such Gaussian membership functions. In order to transform the input data from precise values ​​to values ​​in the fuzzy domain, the fuzzification process of the type-2 fuzzy mapping layer is as follows: For each input dimension X, calculate the upper and lower bound values ​​of the Gaussian membership function associated with each fuzzy set; Associate each input dimension of the input data with two fuzzy sets and calculate the upper and lower bounds of the Gaussian membership function under different dimensions; The output of the second-type fuzzy mapping layer is as follows: in, represents k two-type fuzzy partitions, and Values ​​representing the upper and lower bounds of the Gaussian membership function.

8. The prediction method of type II fuzzy neural network model based on optimized whale algorithm as claimed in claim 7, characterized in that: The type II fuzzy neural network model also includes: In the rule triggering layer, by using the information in the rule list rule_list to determine which rule will be triggered, a layer determines the rules used in the fuzzy reasoning process to calculate the weight of the output. The process of rule triggering is as follows: Confirm the structure of the rule list rule_list: The rule list is a matrix structure, each row of which represents a rule, each column corresponds to an input dimension, and each element of the rule list is represented by the following numerical values: 1 represents the selection of the first fuzzy set associated with the input dimension; 2 represents the selection of the second fuzzy set associated with the input dimension; If rule_list(i,j)=1, then rule i will use the first fuzzy set associated with the jth input dimension; In order to determine which rule will be triggered, it is necessary to check the rule entries in each rule and select the corresponding fuzzy set based on the input data; For rule i, check the value of rule_list(i,j), where j is the index of the input dimension; If rule_list(i,j)=1, the first fuzzy set associated with the j-th input dimension is selected; if rule_list(i,j)=2, the second fuzzy set associated with the j-th input dimension is selected; The output of the mth node in the rule triggering layer is as follows: in, represents k two-type fuzzy partitions, k i Represents the i-th rule in the rule list; Once the fuzzy set to be used is determined, the weight of the rule can be calculated. The upper and lower bound weights of the rule can be obtained by multiplying the membership values ​​of the fuzzy set of each dimension; The calculation formula of the upper bound weight of the rule is as follows: The formula for calculating the lower bound weight of a rule is as follows: Where n represents the number of input dimensions, and They respectively represent the function membership values ​​of the upper and lower bounds of the fuzzy set selected by the j-th input dimension.

9. The prediction method of type II fuzzy neural network model based on optimized whale algorithm as claimed in claim 8, characterized in that: The type II fuzzy neural network model also includes: the fuzzy reduction layer is a key component of the fuzzy neural network, and has M nodes. The task of each node is to convert the output transmitted from the rule trigger layer to generate a type I fuzzy set. The purpose of the type I fuzzy set is to interact with the consequent set parameters in the subsequent fuzzy reasoning process to achieve more advanced reasoning operations; the main steps of fuzzy reduction are as follows: Calculation of the difference weight (delt_ω), delt_ω represents the difference between the upper bound weight and the lower bound weight of each rule. The difference is used for subsequent average weight calculation. For each rule i, the calculation formula is as follows: delt_ω(i)=ω max (i)-ω min (i) Among them, delt_ω(i) represents the difference between the upper bound weight and the lower bound weight of the rule, ω max (i) and ω min (i) represents the upper and lower weights of the rule; Calculate the average weight (ω_av): ω_av is the average weight, which is adjusted by introducing the parameter alfa. For each rule i, the calculation formula is as follows: ω_of(i)=ω min (i)+alpha*divided_ω(i) Among them, ω min (i) represents the lower bound weight, delt_ω(i) represents the difference between the upper bound weight and the lower bound weight of the rule, and alfa represents the parameter that controls the adjustment range of the weight; The subsequent collection layer contains a total of M nodes, and its function is to fuse the output from the previous layer according to a given linear function. The steps of the subsequent collection layer are as follows: When training a fuzzy neural network, the weight parameters are estimated by the least squares method. The goal is to fit the model by adjusting the weight parameters to accurately map the input to the target output. The weight parameters are estimated by minimizing the sum of squared errors, as shown below: CC=argmin||BA*CC||^2 Among them, CC represents a column vector, which contains the parameters to be estimated, usually representing the weight parameters of the model, argmin represents finding CC that can minimize the expression, and represents the parameters that minimize the error; B represents a column vector, which contains the value of the actual target output, A represents a matrix, which contains the fuzzy representation of the input data, each row corresponds to a sample, and each column corresponds to a feature. A*CC represents the output of the model, that is, the fuzzy output obtained by linearly transforming the input data using the parameter CC, BA*CC represents the error between the actual target output and the model output, that is, the residual vector, and ||BA*CC||^2 represents the sum of squares of the error, that is, the square of the Euclidean distance between the target output B and the model output A*CC; Perform a linear transformation of the model. When using the model for prediction or fuzzy reasoning, use the determined optimal weight parameter CC to map the fuzzified input data to the output of the model. The transformation formula is as follows: f=CC*xx Among them, f represents the output of the model, which is a linear function, CC represents the optimal weight parameter obtained after training, and xx represents the vector of input data, including a constant term and the fuzzified input value; The generated linear function is combined with the previous output weights to obtain the final output. The specific steps are as follows: Perform data fusion and fuse the generated linear function with the output weight from the previous step. The specific formula is as follows: Among them, ω_av(m) represents the average weight at the mth node, f m represents the linear function of the linear transformation at the mth node, Calculate the final result output, the formula is as follows:

10. The prediction method of type II fuzzy neural network model based on optimized whale algorithm according to claim 9, characterized in that: The population evolution strategy of the optimized whale algorithm is an important part of the algorithm process. Different sub-populations have different corresponding evolution strategies, including exploratory sub-populations, development sub-populations and moderate sub-populations. The exploratory subpopulation includes: the individuals of the exploratory subpopulation expand the search range, and enhance the global exploration ability by increasing the absolute value of the position vector. The position update adopts a random scaling method to randomly scale the individual position in the search space. The specific formula is as follows: r1=rand(0,1)+1 X(t+1)=X(t)*r1 Where r1 represents a random number between 1 and 2, and t represents the number of iterations; if the current position is a local optimal solution, X(t+1)=X(t)*r1 can help the individual escape from the local optimal solution with a given probability. Under this effect, the absolute value of the current position vector increases, allowing the individual to explore other areas away from the current position. After that, the algorithm can search other areas; The development subpopulation includes individuals in the exploitation subpopulation that evolve positions by conducting in-depth local searches around the current optimal solution. The position update depends on the position of the leader. The specific formula is as follows: X(t+1)=X * (t)*r2 Among them, r2 represents a random number between 0 and 2, and X * (t) is the position vector of the current optimal solution. The individual positions in the development subpopulation are replaced by the increase or decrease of the position vector of the current optimal solution, thereby realizing the search in the surrounding area of ​​the current optimal solution. The position update strategy of the moderate subpopulation includes two cases, one is the position update relative to the leader's position, and the other is the update according to the leader's position; in the first case, the individual position will be updated to the position relative to the leader's position; in the second case, the individual position will be updated according to the leader's position, and the specific formula is as follows: X(t) new =lb+ub-X(t) X(t+)=if X(t) new )better than fit(X(t)?X(t) new :X(t) Among them, lb represents the lower bound of the problem space, ub represents the upper bound of the problem space, fit represents the objective function, and X(t) new Indicates the new location explored; The position update strategy is an important part of the algorithm process. Different sub-populations have different corresponding position update strategies. The specific steps are as follows: The exploratory subpopulation adopts a random leader position to update the position to increase diversity, and a random vector is used to increase the randomness of the position update. The specific formula is as follows: A=2*a*r1-a D=|2*rand(0,1)*X ran (t)-X(t)| X(t+1)=X ran (t)-A*D Among them, X ran (t) represents a random whale in the population in the current iteration number, D represents the absolute value of the difference between the individual position and the random leader position, t represents the iteration number, a represents a dynamic number calculated according to the iteration number, and r1 represents a random number between 0 and 1; The development subpopulation can select different position update strategies according to the random probability p. If p is greater than or equal to 0.5, it will focus more on local search and use a position update strategy relative to the leader position; otherwise, it will adopt a local search strategy and use the leader position for position update. The specific formula is as follows: Among them, p represents the random probability, which is used to determine the location update strategy, X * (t) is the position vector of the current optimal solution, A represents a dynamic number generated according to the number of iterations and random number calculations, and b and l represent parameters used to control position changes. The specific formula for the fitness of the moderate subpopulation is as follows: Among them, p and p1 represent two random probabilities between 0 and 1.

Citation Information

Cited By

  • Neural architecture search method for adaptive multi-field image segmentation task

    CN119204084A