Deep learning numerical regression, no images, custom loss function
10 次查看(过去 30 天)
显示 更早的评论
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 个评论
Matt J
2024-6-20
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.
回答(1 个)
Matt J
2024-6-20
编辑:Matt J
2024-6-20
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 个评论
Matt J
2024-6-26,2:26
编辑:Matt J
2024-6-27,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
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Data Workflows 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!