! Below is an example whereby a network with 2 inputs, 1 output and ! two hidden layers each with 3 nodes is trained to output the XOR of the two inputs: ! The training files should start with the number of inputs, followed by the number of outputs, each on a new lines. ! The rest of the data should then follow, with inputs before their outputs. ! For example, if there are two inputs and one output, the following file suggests that 1 and 0 should result in 1: ! following file suggests that 1 and 0 should result in 1: use neural type(network) :: testNet call neural_init_network(testNet, (/ 2, 3, 5, 1 /)) ! 4 so ung voi 4 layers va so node cua tung layer ! layer 1=input, layer 2,3 hidden, layer va so node trong layer, layer 4=output call neural_train_network_file(testNet, "xor.dat", 10000) ! xor.dat la input data filename: ! Dong 1: So bien dau vao (X1,X2,..,Xm) ! Dong 2: So bien dau ra (y1, Y2, Yk) ! m+k dong tiep theo: m gia tri cua X va k gia tri cua Y ! Neu dung luong mau bang N thi se co N khoi m+k tren day. call neural_save_network(testNet, "network.dat") call neural_load_network(testNet, "network.dat") print *, "1 and 1 = ", neural_use_network(testNet, (/ 1.0d00, 1.0d00 /)) ! Test for x1=1, x2=1 print *, "0 and 1 = ", neural_use_network(testNet, (/ 0.0d00, 1.0d00 /)) ! Test for x1=0, x2=1 End