Clear Filters
Clear Filters

Train multilabel neural network using table format

4 views (last 30 days)
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.

Answers (1)

Neha
Neha on 6 Sep 2023
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!

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!