- Check that all the supporting functions ("preprocessMiniBatch", "modelPosteriorSample", "logLikelihood", "modelLoss", "negativeELBO", "averageNegativeELBO" and "KLWeight") are defined at the end of "demo_BNN.mlx". These functions are defined in "TrainBayesianNeuralNetworkUsingBayesByBackpropExample.mlx".
- Check that all the helper .M files are present in the same directory as "demo_BNN.mlx". These files are "bayesFullyConnectedLayer.m", "initializeGlorot.m" and "logProbabilityNormal.m". These files are present in the same directory as "TrainBayesianNeuralNetworkUsingBayesByBackpropExample.mlx".
Deep Learning Train Bayesian Neural Network
12 次查看(过去 30 天)
显示 更早的评论
when I use the MATLAB TrainBayesianNeuralNetworkUsingBayesByBackpropExample
I can work with good results as it was offered
However, when I copied this code to m.file , named demo_BNN
I have found lots of problems
in Train model section
mbq = minibatchqueue(dsTrain, ...
MiniBatchSize= miniBatchSize, ...
MiniBatchFcn= @preprocessMiniBatch, ...
MiniBatchFormat=["SSCB" "CB"]);
Error using minibatchqueue>iValidateMiniBatchFcn
Invalid value for 'MiniBatchFcn'. Unable to find function 'preprocessMiniBatch'.
Error in minibatchqueue>iParseInputs (line 786)
iValidateMiniBatchFcn(options.MiniBatchFcn, numVariables, options.NumOutputs);
Error in minibatchqueue (line 288)
options = iParseInputs(numVariables, varargin{:});
Error in demo_BNN (line 82)
mbq = minibatchqueue(dsTrain, ...
However, there are similar operations from document of minibatchqueue
SImilaraly, In monitor section
[elboLoss,rmsError,gradientsNet,gradientsNoise] = dlfeval(@modelLoss, ...
net,X,T,samplingNoise,miniBatchIdx,numIterationsPerEpoch);
Undefined function 'modelLoss' for input arguments of type 'dlnetwork'.
Error in deep.internal.dlfeval (line 17)
[varargout{1:nargout}] = fun(x{:});
Error in deep.internal.dlfevalWithNestingCheck (line 19)
[varargout{1:nargout}] = deep.internal.dlfeval(fun,varargin{:});
Error in dlfeval (line 31)
[varargout{1:nargout}] = deep.internal.dlfevalWithNestingCheck(fun,varargin{:});
Error in demo_BNN (line 123)
[elboLoss,rmsError,gradientsNet,gradientsNoise] = dlfeval(@modelLoss, ...
0 个评论
回答(1 个)
Yash
2024-3-18
Hi Joy,
I tried reproducing the errors on my end. However, "demo_BNN.mlx" is working fine for me. I created a copy of "TrainBayesianNeuralNetworkUsingBayesByBackpropExample.mlx" and renamed it to "demo_BNN.mlx".
Ensure the following to try to resolve the errors:
Attaching "demo_BNN.mlx" and other helper functions for your reference.
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!