필터 지우기
필터 지우기

net.predictFcn produces 'Argument to dynamic structure reference must evaluate to a valid field name.'

조회 수: 2 (최근 30일)
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

채택된 답변

Stephen Gray
Stephen Gray 2023년 7월 18일
Hi all. Solved it myself. I should have been using net(matrix) instead of predictFcn to get the results. Error is a bit misleading though.
SPG

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by