Deep learning numerical regression, no images, custom loss function
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Matt J
el 20 de Jun. de 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.
Respuestas (1)
Matt J
el 20 de Jun. de 2024
Editada: Matt J
el 20 de Jun. de 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 comentarios
Matt J
el 26 de Jun. de 2024 a las 2:26
Editada: Matt J
el 27 de Jun. de 2024 a las 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
Ver también
Categorías
Más información sobre Image Data Workflows en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!