PNN Neural Network Class - MetaTrader 5 Library | MT5 EA Download - MetaTrader 5 Resources
The CNetPNN class implements Probabilistic Neural Network (PNN).
The creation of the network is declared as a class parameter constructor.
CNetPNN * network = new CNetPNN (input vector size, number of classes (classification target));The numbering of classes (classification targets) starts from zero and must be consecutive. For example, if 3 classes are set, the number of classes must be: 0,1,2.
The learning network is provided by calling the Learn method (number of learning modes, input data array, output data array, number of learning cycles, maximum learning error).
The input and output learning data are located vector by vector in a one-dimensional array. The class number in the input data must be defined on each input learning vector. The learning process is either limited by the learning period or by the amount of error allowed.
The Learn method returns the following values:
To obtain the response of the network, the calculation method (array of input vectors) is used. The Calculate method returns the class number corresponding to the input vector, or -1 if the network has not learned.
The Save (open a file handle using the FILE_WRITE and FILE_BIN flags) and Load (open a file handle using the FILE_READ and FILE_BIN flags) methods are used to save a network to a file and load a network from a file respectively. Network topology, learning errors, and array weights are saved to files. If the loaded network topology parameters are different from the established network topology parameters, the network will not be loaded and the Load method will return false.
The use of this class is shown in the attached sample: Test_PNN_XOR - Learn network function "XOR".
Attachment download
📎 class_pnn.mqh (12.14 KB)
📎 test_pnn_xor.mq5 (2.01 KB)
Source: MQL5 #1323
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •