Perceptron – Single layer neural network

If you need an Indicator or Signal developed or translated from other language, please post all Indicator development REQUESTS to this section here.

Moderator: admin

Re: Perceptron – Single layer neural network

Postby Gilles » Mon Aug 21, 2023 2:18 am

Hi Apprentice,
I have implemented the "sigmoid" function, backpropagation with gradient calculation, weight updates, and the displayed result on the screen is: MLP: N/A, and error: N/A.

I don't see where my mistake is.
Can you help me?

Attached are my diagram and my code.

Thank you very much :)
Attachments
Capture d’écran 2023-08-20 140510.png
RSI_MLP_sigmoid.lua
(30.02 KiB) Downloaded 23 times
Gilles
FXCodeBase: Initiate
 
Posts: 158
Joined: Tue Jul 31, 2018 8:28 am
Location: France

Re: Perceptron – Single layer neural network

Postby Apprentice » Wed Aug 23, 2023 3:17 am

We have added your request to the development list.
Development reference 751.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36495
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Perceptron – Single layer neural network

Postby Apprentice » Wed Aug 23, 2023 5:51 am

EURUSD H3 (08-23-2023 1245).png


Since I don't know what your goal is, I might be completely off.
These are some of my observations.

The main problems.
1. missing Internal Stream
2. two update functions
3. inadequate verification of the number of elements required for calculation
4. Unnecessary loop
5. Call of MLP:update(mode)
MLP external indicator call is not defined.
Note Output stream must not have the same variable name as the variable for the external indicator call.

MLP_VAMA.lua
(10.12 KiB) Downloaded 23 times


EURUSD H3 (08-23-2023 1323).png

Similarly for Multilayer_Perceptron.lua
Multilayer_Perceptron.lua
(9.71 KiB) Downloaded 20 times
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36495
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Perceptron – Single layer neural network

Postby Apprentice » Wed Aug 23, 2023 6:20 am

Not sure about RSI_MLP_sigmoid
RSI_MLP_sigmoid.lua
(26.68 KiB) Downloaded 25 times


Can you review it?
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36495
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Perceptron – Single layer neural network

Postby Gilles » Thu Aug 24, 2023 5:22 am

Hi Apprentice,
At the beginning, I have 4 inputs (RSI) that should allow the model to get a general idea of the market's evolution. The weights of the inputs are used to calculate the output of the first layer.
If you look at my diagram, you'll see that all the connections have a weight. And it's the path they take that allows information to be communicated through the network to the output layer.
It's a forward propagation through the network to generate an output prediction, what we call a pass, a full journey through the network, it's an epoch.
At the end of each epoch, I calculate the error.
So, at this point, the model is not training and not learning.
It's only the implementation of the backpropagation that allows adjusting the network's weights based on the error between the prediction and the actual value.

What allows the model to learn is the adjustment of the weights through the process of forward propagation and backpropagation for a defined number of epochs!
I hope this will help you understand what ++

Note: I don't understand why the loop seems unnecessary to you.

My goal is for the model to learn, and for that, it needs to adjust its weights.

What allows or doesn't allow us to see the decision the model makes is the display of the arrows, conditioned by the slope of the MLP[period] curve.
Gilles
FXCodeBase: Initiate
 
Posts: 158
Joined: Tue Jul 31, 2018 8:28 am
Location: France

Re: Perceptron – Single layer neural network

Postby Apprentice » Thu Aug 24, 2023 5:25 am

RSI_MLP_sigmoid.lua
(28.49 KiB) Downloaded 22 times

I tried to simplify the structure.
Looks like the weight of the update is problematic.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36495
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Perceptron – Single layer neural network

Postby Gilles » Fri Aug 25, 2023 2:41 am

Hi Apprentice,
Thank you for your help; your approach is very intriguing, especially with the streams for each weight. This allows checking if the weights are being updated properly. I'll go over all of this with a clear head and get back to you. Thank you very much.
Gilles
FXCodeBase: Initiate
 
Posts: 158
Joined: Tue Jul 31, 2018 8:28 am
Location: France

Previous

Return to Indicator and Signal Requests

Who is online

Users browsing this forum: Bing [Bot] and 51 guests