Train multilabel neural network using table format
6 次查看(过去 30 天)
显示 更早的评论
Hi,
I'm looking to expand the neural network for an acoustic software package that currently trains on multiclass data using the 'trainNetwork' function into one that can do multilabel classification. The (currently multiclass) input data are individual 1x190 sound spectra formatted into a table like such:
2000×2 table
Spectra Class
__________________ ________
{1×190 double} 1
{1×190 double} 1
{1×190 double} 1
{1×190 double} 1
... ...
I'm specifically having trouble in adapting an appropiate loss function for this data format. The existing code used 'crossentropyex' in the "layers" input, which I believe is not compatible with multilabeling. I have been trying to input a binary cross entropy loss by creating a custom layer using the 'crossentropy' function, but all examples and guides for uses images in a different data format and I am confused on how to make them work for a table format.
Any insights on how to get around this issue is much appreciated.
0 个评论
回答(1 个)
Neha
2023-9-6
Hi David,
I understand that you want to train a neural network with multiclass input data. You can use "num2cells" to convert both “data.Spectra” and “data.Class” to cell arrays. You need to ensure that the labels are one-hot encoded.
spectra=num2cell(data.Spectra',1)
The input and output data would now be cell arrays of size 1x2000. You can refer to the steps in the following documentation link to ensure that the network uses binary cross entropy as its loss function:
Hope this helps!
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!