Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

GRNN Neural Network Class - MetaTrader 5 Library | MT5 EA Download - MetaTrader 5 Resources

author EAcpu | 2 reads | 0 comments |

The CNetGRNN class implements General Regression Neural Network (GRNN).

The creation of the network is declared as a class parameter constructor.

 CNetGRNN *net= new CNetGRNN (input vector size, output vector size);

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 learning process is limited by the number of learning epochs or the acceptable error.

The Learn method returns the following values:

The calculation method (array of input vectors, array of network responses) is used to obtain the response network.

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 usage of this class is shown in the attached sample: Test_GRNN_XOR - learns the network function "exclude OR", Test_GRNN_MUL_ADD - learns the network integer multiplication and addition.


Attachment download

📎 class_grnn.mqh (11.41 KB)

📎 test_grnn_xor.mq5 (2.93 KB)

📎 test_grnn_mul_add.mq5 (2.12 KB)

Source: MQL5 #1324

Verification code Refresh