Neural Network sim() Error, possibly related to object references
1 view (last 30 days)
Show older comments
I have three classes: *DFT *Nets *QVE
QVE has a reference to Nets and Nets has a reference to DFT.
The nets class has a cell array of neural networks that are trained. One of the functions in the Nets class uses sim() to simulate the network using some DFT data. This is the function:
function ntransform = approx(obj,index,rins,iins)
rapprox = sim(obj.trnets{index},obj.DFT.rins);
iapprox = sim(obj.tinets{index},obj.DFT.iins);
napprox = rapprox{1} + 1i*iapprox{1};
ntransform = obj.DFT.rtransform(napprox, index);
end
In the function obj is the Nets class. Trnets is a property that has a cell array of trained networks for the real part of some data being fitted. Tinets is the same things but for the imaginary parts. The DFT.rtransform function just does a linear transformation to the complex data returned by the networks.
Here is the problem: This function returns the correct result and there are no problems. However if I copy and paste the code in the command window and update the references (i.e. if q is the instance of QVE,
sim(q.nets.trnets{1},q.nets.DFT.rins)
for the first network). This command returns zeros for all the outputs. If I inspect each of the objects being referenced individually, they are valid references. The function call to sim() doesn't return any errors, it just returns zero. This behavior even occurs when I ask the network to simulate the data it was trained on.
I can't seem to figure out why calling sim() in the context of the Nets class works, but when I call it in a different context and pass the correct variables to the function, it returns zero. I have stepped through the code several times and double checked and I can't find the problem. I think I am missing some information as to how pointers are being handled for nested classes or something similar.
Any help or guidance would be wonderful!
0 Comments
Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!