Deep learning numerical regression, no images, custom loss function
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I want to define a neural network or deep learning. Firstly, I have [500 * 4] data with a sample size of 500, each with 4 features (x1, x2, x3, x4).
The output variables are y1 and y2 ([500 * 2]), but I don't have any output data, I only have their range of values (such as y1 in range (0-1)).
I have the variable z, which is the measured data, z=5 * e ^ (y1)+7 * sin (y2)
The loss function will be defined as : z(measure) - z (y1, y2)
The purpose of this neural network is to estimate y1 and y2 based on x1, x2, x3, x4.
For instance:
I know information about 500 cats, which are: x1 (height), x2 (weight), x3 (food intake), x4 (excretion).
I also know the age of these 500 cats: z
Now, I want to estimate y1 (cancer probability) and y2 (hair loss). The range of y1 is 0-1, and the range of y2 is -10 to 10
Do you know how to establish such deep learning or neural networks? Is there a simple example?
2 commentaires
Matt J
le 20 Juin 2024
I have mild doubts about whether decoding two hidden variables (y1,y2) from only a single observed variable (z) is a well-posed regression problem.
Réponses (1)
Matt J
le 20 Juin 2024
Modifié(e) : Matt J
le 20 Juin 2024
I don't know what kind of hidden layer architecture you would want for such an application, but the network below (layer graph attached) is a possible starting point. Note that the final concatenationLayer, which combines y1 and y2 into a single array, is optional. You could just have a network with two separate outputs.
load layer_graph
Xdata=rand(4,500);
Ydata=rand(2,500);
Zdata=5 * exp(Ydata(1,:)) + 7 * sin(Ydata(2,:));
loss=@(Y,T) mean( abs( 5 * exp(Y(1,:)) + 7 * sin(Y(2,:)) -T ) );
net=trainnet(Xdata',Zdata',dlnetwork(lgraph),...
loss,trainingOptions('adam','MaxEpochs',500))
2 commentaires
Matt J
le 26 Juin 2024 à 2:26
Modifié(e) : Matt J
le 27 Juin 2024 à 20:52
I still have a problem, which is that there is no limit to the range of y
You should be seeing y in the appropriate range with the general architecture I gave you. The tanh and clippedRelu layers are implicitly bounded,
Thank you very much for your answer, it has been very helpful to me.
You're welcome, but please Accept-click the asnwer if it solves your problem
Voir également
Catégories
En savoir plus sur Image Data Workflows dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!