net.predictFcn produces 'Argument to dynamic structure reference must evaluate to a valid field name.'
Show older comments
The following code works great, i.e. I get the correct result an d a good performance score. How ever when I use the net.predictFcn on a new matrix or in fact on the trining data I get the 'Argument to dynamic structure reference must evaluate to a valid field name.' error. I've looked at other example from people who have got the same error but cannot work out the issue. The code snippit is :-
Inps = readtable("D:\RacingFormBook\Res.xlsx", opts, "UseExcel", false);
%% Clear temporary variables
clear opts
Outs=Inps(:,11);
Inps = removevars(Inps, 'FPos');
OutsM=table2array(Outs);
OutsM=OutsM';
%Convert catergorical to numeric next using unique
[GN, ~, CourseC] = unique(Inps(:,3));
[GN, ~, GoingC] = unique(Inps(:,4));
[GN, ~, HorseC] = unique(Inps(:,5));
[GN, ~, JockeyC] = unique(Inps(:,6));
[GN, ~, TrainerC] = unique(Inps(:,9));
Inps = removevars(Inps, {'Course','Going','HorseName','Jockey','Trainer'});
InpsM = table2array(Inps);
InpsMC=cat(2,InpsM,CourseC,GoingC,HorseC,JockeyC,TrainerC);
InpsMC=InpsMC';
clear GoingC HorseC TrainerC CourseC JockeyC GN Inps Outs InpsM
InpsMCG=gpuArray(InpsMC);
OutsMG=gpuArray(OutsM);
net=feedforwardnet([60,30,1]);
net.trainFcn = 'trainscg';
net=train(net,InpsMCG,OutsMG);
Then I try the net.predictFcn on InpsMCG or another set of imported results and get the error. I'm really stumped so has anyone got any ideas?
SPG
Accepted Answer
More Answers (0)
Categories
Find more on Model Statistics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!