Input Process Settings fitnet not working properly

1 view (last 30 days)
For the following code below
clear;
clc;
x1=0:0.01:2; %need to fix this error
x2=0:0.01:2; %
hiddenLayer=3;
input=combvec(x1,x2);
target=5*input(1,:)+input(2,:).^3 ;
net=fitnet(hiddenLayer);
net.inputs{1}.processFcns={'mapminmax'};
net.outputs{2}.processFcns = {'mapminmax'};
net.inputs{1}.processParams{1}
[net, tr]=train(net,input,target);
input_setting=net.inputs.processSettings;
output_setting=net.outputs.processSettings;
I am getting null net.inputs.processSettings when the variables x1 and x2 are set to these below values
x1=0:0.01:2;
x2=0:0.01:2;
For all other cases the values seems to coming out fine example
x1=0:0.01:3;
x2=0:0.01:3;

Accepted Answer

Mohith Kulkarni
Mohith Kulkarni on 13 Oct 2020
Hi Aditya,
Unfortunately, this seems likely to be a bug. I have brought this issue to the notice of our developers. They will investigate the matter further.
Workaround:
It's normal for some of the processing functions to be removed from the final 'net' structure but only when they're unused. In this case, I don't think they've been removed correctly.
Since this does not happen for most datasets, if this is not the final dataset the you want to use, I suggest you carry on with your analysis with a different dataset if that's the case.
If this really is the dataset you would like to use, then you could try to remove the mapminmax function from the input and output preprocessing functions. It doesn't seem to make a big difference in results for this specific data:
net.inputs{1}.processFcns = {};
net.outputs{2}.processFcns ={};
One other option could be to remove the 'mapminmax' function from the input processing functions and do the processing offline. Bearing in mind that the data is internally split into train/test/val datasets. The offline processing should respect this split, by fixing the partition:
net.divideFcn = 'divideind';
net.divideParam.trainInd = train_ind;
net.divideParam.valInd = val_ind;
net.divideParam.testInd = test_ind;
Where train_ind, test_ind and val_ind are the indices of the train, test and validation datasets determined by you.
You can use the function 'mapminmax' to do the processing on the training data and apply to the test/val datasets, as follows:
[Xtrain,settings] = mapminmax(Xtrain);
Xtest = mapminmax.apply(Xtest,settings);

More Answers (0)

Community Treasure Hunt

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

Start Hunting!