Ask an expert. Trust the answer.

Using weights from OL in CL training; how should the weight vector

Your academic and career questions answered by verified experts

Teacher helping student with MATLAB programming

Using weights from OL in CL training; how should the weight vector

Staffan asked: neural network , narnet , time series prediction

Learn how to effectively use Online Learning (OL) weights in Closed-Loop (CL) training. Optimize your weight vector for enhanced model performance. Read more!

Expert Answer

Profile picture of Kshitij Singh Kshitij Singh answered . 2025-07-12 22:28:08

% Using weights from OL in CL training; how should the % weight vector(s)/cell matrices be formatted when used % as input in train() ? % 2 views (last 30 days) % Asked by Staffan 17MAY2016 % % I am trying to attach the weights obtained in OL in the CL % training. I can see that the amount of data contained in the % weight sets; .IW, .LW and .B are altered when going from % open loop to closed loop....still, the weight vector obtained % from getwb() have the same amount of data for both in % OL and CL. Any ideas how to format the weight vector (in % the code below the weight vector is designated EWc1) % before inserting this to train()? Is there any way that % preparets() (or a similar function) can handle this?
 
GEH0 =[ ' YOU HAVE CONFUSED NETWORK WEIGHT BIAS '... ' VECTORS, WB, FROM GETWB WITH ERROR ' ... ' WEIGHTS, EW, OF LENGTH N THAT ARE CHOSEN ' ... ' BY THE PROGRAMMER TO WEIGHT EACH TERM ' .. ' IN MEAN SQUARE ERROR ' ]
 
GEH1 = 'I REMOVED SOME ENDING SEMICOLONS BELOW TO CHECK RESULTS'
 
clc
% Code and error message:
 close all
 clear all
% format long

   T = simplenar_dataset; 
   [ I, N ] = size(T)   % [ 1 100 ]

   d = 5
   GEH2= ' WHY 5 ?'

   FD = 1:d; 
   H = 10;
   % open net number one, input for closed net number 
   % one and closed net number two
   neto1 = narnet( FD, H );
   neto1.divideFcn = 'divideblock';
   [ Xo1, Xoi1, Aoi1, To1] = preparets( neto1, {}, {}, T );
   to = cell2mat( To1 ); 
  %  zto = zscore(to,1); 
    varto1 = mean(var(to',1))  % 0.062747
%  minmaxto = minmax([ to ; zto ]);

   rng( 'default' )
  % [neto1,tro,Yo1,Eo1,Aof1,Xof1] = train( neto1, Xo1, To1, Xoi1, Aoi1 );
   GEH3 = ' ERROR1: SWITCH Aof1 and Xof1'
    [neto1,tro,Yo1,Eo1,Xof1,Aof1] = train( neto1, Xo1, To1, Xoi1, Aoi1);
   %[Yo1,Xof1,Aof] = neto1( Xo1, Xoi1, Aoi1 ); 
   GEH4 = 'ERROR: Aof1 not Aof'
   %Eo1 = gsubtract( To1, Yo1 );
   GEH5 = ' COMMENT ABOVE 2 REDUNDANT STATEMENTS'

   NMSEo1 = mse( Eo1 ) /varto1 %1.6546e-09
   GEH6 = ' ALWAYS MAKE SURE NMSEo1 IS ADEQUATE BEFORE CL'

   yo1 = cell2mat( Yo1 );
   netc1 = closeloop(neto1);  
   EWo1=getwb(neto1);
   EWc1=getwb(netc1);
   isequal( EWo1, EWc1) % 1
   GEH7 = [ 'INCORRECT NOTATION: EW IS RESERVED FOR MSE' ...
                  ' ERROR WEIGHTS. USE WBo1 AND WBc1 FOR WEIGHT '...
                  ' BIAS VECTORS ' ]

   %netc1.divideFcn = 'divideblock';
   GEH8 = 'ABOVE ASSIGNMENT IS UNNECESSARY'

   [ Xc1, Xci1, Aci1, Tc1, EWc1 ] = preparets( netc1, {}, {}, T, EWo1 ); %  1.232667933023756e-08
   GEH9 = 'ERROR: SEE GEH0'
   GEH10 = 'WHAT IN THE WORLD IS 1.232667933023756e-08 ???'
% isequal( EWo1, cell2mat(EWc1)); % 1 if EWo1 is included in preparets, 0 if EWo1 is NOT included in preparets % figure(1) % plot(1:length(EWo1),EWo1,1:length(cell2mat(EWc1)),cell2mat(EWc1))
 
 
   GEH11 = 'DELETE ABOVE 3 STATEMENTS'

   isequal( Tc1, To1);
   tc = to;
   [netc1,troc1,Yc1,Ec1,Acf1,Xcf1] = train( netc1, Xc1, Tc1, Xci1, Aci1, EWc1); 

   GEH12 = 'ERRORS: 1: SWITCH Acf1 AND Xcf1 2: REMOVE EWc1'

   GEH13 = 'I"LL STOP HERE'


Not satisfied with the answer ?? ASK NOW

Frequently Asked Questions

MATLAB offers tools for real-time AI applications, including Simulink for modeling and simulation. It can be used for developing algorithms and control systems for autonomous vehicles, robots, and other real-time AI systems.

MATLAB Online™ provides access to MATLAB® from your web browser. With MATLAB Online, your files are stored on MATLAB Drive™ and are available wherever you go. MATLAB Drive Connector synchronizes your files between your computers and MATLAB Online, providing offline access and eliminating the need to manually upload or download files. You can also run your files from the convenience of your smartphone or tablet by connecting to MathWorks® Cloud through the MATLAB Mobile™ app.

Yes, MATLAB provides tools and frameworks for deep learning, including the Deep Learning Toolbox. You can use MATLAB for tasks like building and training neural networks, image classification, and natural language processing.

MATLAB and Python are both popular choices for AI development. MATLAB is known for its ease of use in mathematical computations and its extensive toolbox for AI and machine learning. Python, on the other hand, has a vast ecosystem of libraries like TensorFlow and PyTorch. The choice depends on your preferences and project requirements.

You can find support, discussion forums, and a community of MATLAB users on the MATLAB website, Matlansolutions forums, and other AI-related online communities. Remember that MATLAB's capabilities in AI and machine learning continue to evolve, so staying updated with the latest features and resources is essential for effective AI development using MATLAB.

Without any hesitation the answer to this question is NO. The service we offer is 100% legal, legitimate and won't make you a cheater. Read and discover exactly what an essay writing service is and how when used correctly, is a valuable teaching aid and no more akin to cheating than a tutor's 'model essay' or the many published essay guides available from your local book shop. You should use the work as a reference and should not hand over the exact copy of it.

Matlabsolutions.com provides guaranteed satisfaction with a commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been empanelled after extensive research and quality check.

Matlabsolutions.com provides undivided attention to each Matlab assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work done at the best price in industry.