How to use a self-made loss function for a simple Neural Network in Matlab?
21 次查看(过去 30 天)
显示 更早的评论
I have been using
net = feedforwardnet(10) %or
net = fitnet(10)
for my regression problem in Matlab. I am using simple networks with 1 or 2 layers and ReLU activation function (net.transferFcn = 'poslin').
But now, I have to use a self-made custom loss functions instead of 'mse' (mean squared error). Could you please let me know how can I do this.
I have found the following document regarding using custom layers and loss functions:https://www.mathworks.com/help/deeplearning/ug/define-custom-regression-output-layer.html
But this is regarding to complex Neural Networks like CNN. I could not understand how to simplify this for a normal deep neural network.
0 个评论
回答(2 个)
yanqi liu
2021-12-30
yes,sir,may be it same on:https://ww2.mathworks.cn/matlabcentral/answers/1618945-how-to-use-a-self-made-loss-function-for-a-simple-neural-net
net=newff([0,1],[5,1],{'tansig','logsig'},'traingd')
net.performFcn
we can find the default is mse
so,make the self definition function,https://www.mathworks.com/matlabcentral/answers/64319-neural-network-how-to-use-a-custom-performance-function
0 个评论
pathakunta
2024-1-26
I have been using net = feedforwardnet(10) %or net = fitnet(10) for my regression problem in Matlab. I am using simple networks with 1 or 2 layers and ReLU activation function (net.transferFcn = 'poslin'). But now, I have to use a self-made custom loss functions instead of 'mse' (mean squared error). Could you please let me know how can I do this. I have found the following document regarding using custom layers and loss functions:https://www.mathworks.com/help/deeplearning/ug/define-custom-regression-output-layer.html But this is regarding to complex Neural Networks like CNN. I could not understand how to simplify this for a normal deep neural network.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sequence and Numeric Feature Data Workflows 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!