Month: August 2024
Deep learning: predict and forward give very inconsistent result with batch normalisation
Hi there,
I have a dnn with BatchNormalization layers. I did [Uf, statef] = forward(dnn_net, XT); "statef" returned from forward call should contain the learned mean and variance of the BN layers. I then update the dnn_net.State = statef so that the dnn_net.State is updated with the learned mean and var from the forward call. Then I did Up = predict(dnn_net,XT) [on the same data XT as the forward call]. Then I compare the mse(Up,Uf) and it turns out to be quite large (e.g 2.xx). This is totally not expected. Please help
I have created a simple test script to show the problem below:
numLayer = 9;
numNeurons = 80;
layers = featureInputLayer(2);% 2 input features
for i = 1:numLayer-1
layers = [
layers
fullyConnectedLayer(numNeurons)
batchNormalizationLayer
geluLayer
];
end
layers = [
layers
fullyConnectedLayer(4)];
dnn_net = dlnetwork(layers,’Initialize’,true);
dnn_net = expandLayers(dnn_net);% expand the layers in residual blocks
dnn_net = dlupdate(@double,dnn_net);
X = 2*pi*dlarray(randn(1,1000),"CB");
T = 2*pi*dlarray(randn(1,1000),"CB");
XT = cat(1,X,T);
% compute DNN output using forward function, statef contains
% batchnormlayers (learned means and learned var)
[Uf,statef] = forward(dnn_net,XT);
dnn_net.State = statef;% update the dnn_net.State (so that it has the BN layers updated learned means and var
Up = predict(dnn_net,XT);
% DNN output between predict call and forward call shoudl be the same in
% this case (becausae the dnn_net.State is updated with the same learned mean/var from forward calls.
% However, it is not the case. The err is quite large
plot(Uf(1,:),’r-‘);hold on; plot(Up(1,:),’b-‘);
err = mse(Uf(1,:),Up(1,:))Hi there,
I have a dnn with BatchNormalization layers. I did [Uf, statef] = forward(dnn_net, XT); "statef" returned from forward call should contain the learned mean and variance of the BN layers. I then update the dnn_net.State = statef so that the dnn_net.State is updated with the learned mean and var from the forward call. Then I did Up = predict(dnn_net,XT) [on the same data XT as the forward call]. Then I compare the mse(Up,Uf) and it turns out to be quite large (e.g 2.xx). This is totally not expected. Please help
I have created a simple test script to show the problem below:
numLayer = 9;
numNeurons = 80;
layers = featureInputLayer(2);% 2 input features
for i = 1:numLayer-1
layers = [
layers
fullyConnectedLayer(numNeurons)
batchNormalizationLayer
geluLayer
];
end
layers = [
layers
fullyConnectedLayer(4)];
dnn_net = dlnetwork(layers,’Initialize’,true);
dnn_net = expandLayers(dnn_net);% expand the layers in residual blocks
dnn_net = dlupdate(@double,dnn_net);
X = 2*pi*dlarray(randn(1,1000),"CB");
T = 2*pi*dlarray(randn(1,1000),"CB");
XT = cat(1,X,T);
% compute DNN output using forward function, statef contains
% batchnormlayers (learned means and learned var)
[Uf,statef] = forward(dnn_net,XT);
dnn_net.State = statef;% update the dnn_net.State (so that it has the BN layers updated learned means and var
Up = predict(dnn_net,XT);
% DNN output between predict call and forward call shoudl be the same in
% this case (becausae the dnn_net.State is updated with the same learned mean/var from forward calls.
% However, it is not the case. The err is quite large
plot(Uf(1,:),’r-‘);hold on; plot(Up(1,:),’b-‘);
err = mse(Uf(1,:),Up(1,:)) Hi there,
I have a dnn with BatchNormalization layers. I did [Uf, statef] = forward(dnn_net, XT); "statef" returned from forward call should contain the learned mean and variance of the BN layers. I then update the dnn_net.State = statef so that the dnn_net.State is updated with the learned mean and var from the forward call. Then I did Up = predict(dnn_net,XT) [on the same data XT as the forward call]. Then I compare the mse(Up,Uf) and it turns out to be quite large (e.g 2.xx). This is totally not expected. Please help
I have created a simple test script to show the problem below:
numLayer = 9;
numNeurons = 80;
layers = featureInputLayer(2);% 2 input features
for i = 1:numLayer-1
layers = [
layers
fullyConnectedLayer(numNeurons)
batchNormalizationLayer
geluLayer
];
end
layers = [
layers
fullyConnectedLayer(4)];
dnn_net = dlnetwork(layers,’Initialize’,true);
dnn_net = expandLayers(dnn_net);% expand the layers in residual blocks
dnn_net = dlupdate(@double,dnn_net);
X = 2*pi*dlarray(randn(1,1000),"CB");
T = 2*pi*dlarray(randn(1,1000),"CB");
XT = cat(1,X,T);
% compute DNN output using forward function, statef contains
% batchnormlayers (learned means and learned var)
[Uf,statef] = forward(dnn_net,XT);
dnn_net.State = statef;% update the dnn_net.State (so that it has the BN layers updated learned means and var
Up = predict(dnn_net,XT);
% DNN output between predict call and forward call shoudl be the same in
% this case (becausae the dnn_net.State is updated with the same learned mean/var from forward calls.
% However, it is not the case. The err is quite large
plot(Uf(1,:),’r-‘);hold on; plot(Up(1,:),’b-‘);
err = mse(Uf(1,:),Up(1,:)) predict and forward gives inconsistent outputs MATLAB Answers — New Questions
how to save variable data that we changed ?
this is my code:
nSamp = 3251;
Fs = 1024e3;
SNR = 40;
rng default
t = (0:nSamp-1)’/Fs;
x = sin(2*pi*t*100.123e3);
x = x + randn(size(x))*std(x)/db2mag(SNR);
[Pxx,f] = periodogram(x,kaiser(nSamp,38),[],Fs);
meanfreq(Pxx,f);
i change the variable in this code to my dataset . then after run, the variable go to its original data . how to solve this problem?this is my code:
nSamp = 3251;
Fs = 1024e3;
SNR = 40;
rng default
t = (0:nSamp-1)’/Fs;
x = sin(2*pi*t*100.123e3);
x = x + randn(size(x))*std(x)/db2mag(SNR);
[Pxx,f] = periodogram(x,kaiser(nSamp,38),[],Fs);
meanfreq(Pxx,f);
i change the variable in this code to my dataset . then after run, the variable go to its original data . how to solve this problem? this is my code:
nSamp = 3251;
Fs = 1024e3;
SNR = 40;
rng default
t = (0:nSamp-1)’/Fs;
x = sin(2*pi*t*100.123e3);
x = x + randn(size(x))*std(x)/db2mag(SNR);
[Pxx,f] = periodogram(x,kaiser(nSamp,38),[],Fs);
meanfreq(Pxx,f);
i change the variable in this code to my dataset . then after run, the variable go to its original data . how to solve this problem? change and save variables MATLAB Answers — New Questions
Estimation of average angles based on quadrants
Hello, I would appreaciate any suggestion to estimate the total average of angles based on the location of the quadrants. The length of the matrix of the angles to assess the average is variable and for these examples I am assuming that the length of the matrices are constant:
angles=[2;355;0;6]
I should have the following answer for the average:
average_angle=0.75;
% Another case:
angles=[-2;350;0;-3 ]
average=356.25;
% another case
angles=[5;36;45;-5]
average=110.25
% another case
angles=[35;36;45;50]
average=41.5
% another case
angles=[180;150;-8;130]
average=203
I would appreciate the help if there is a quick command in Matlab to do these operations without having too many conditions.Hello, I would appreaciate any suggestion to estimate the total average of angles based on the location of the quadrants. The length of the matrix of the angles to assess the average is variable and for these examples I am assuming that the length of the matrices are constant:
angles=[2;355;0;6]
I should have the following answer for the average:
average_angle=0.75;
% Another case:
angles=[-2;350;0;-3 ]
average=356.25;
% another case
angles=[5;36;45;-5]
average=110.25
% another case
angles=[35;36;45;50]
average=41.5
% another case
angles=[180;150;-8;130]
average=203
I would appreciate the help if there is a quick command in Matlab to do these operations without having too many conditions. Hello, I would appreaciate any suggestion to estimate the total average of angles based on the location of the quadrants. The length of the matrix of the angles to assess the average is variable and for these examples I am assuming that the length of the matrices are constant:
angles=[2;355;0;6]
I should have the following answer for the average:
average_angle=0.75;
% Another case:
angles=[-2;350;0;-3 ]
average=356.25;
% another case
angles=[5;36;45;-5]
average=110.25
% another case
angles=[35;36;45;50]
average=41.5
% another case
angles=[180;150;-8;130]
average=203
I would appreciate the help if there is a quick command in Matlab to do these operations without having too many conditions. average estimation of angles bases on quadrants MATLAB Answers — New Questions
Permissions are just not premising
I have the sharing policy set for both SharePoint and OneDrive, set to “Anyone with the link” but when I go to share a folder from a SharePoint site, I do not appear to have the option for “Anyone with the link”.
I have the sharing policy set for both SharePoint and OneDrive, set to “Anyone with the link” but when I go to share a folder from a SharePoint site, I do not appear to have the option for “Anyone with the link”. Read More
Cannot login: PIN isn’t available
After multiple blue screens with different stop codes and restarts, I cannot get into my laptop.
Login is showing “Something happened and your PIN is not available. Click to set up your PIN again.” Clicking “Set up my PIN” does nothing. Pop up: explorer.exe – System error
The system detected an overrun of a stack-based buffer in this application. This overrun could potentially allow a malicious user to gain control of this application.
I tried to reser from advanced settings but it will not reset. Is there anything I can do to get into my laptop?
After multiple blue screens with different stop codes and restarts, I cannot get into my laptop.Login is showing “Something happened and your PIN is not available. Click to set up your PIN again.” Clicking “Set up my PIN” does nothing. Pop up: explorer.exe – System error The system detected an overrun of a stack-based buffer in this application. This overrun could potentially allow a malicious user to gain control of this application. I tried to reser from advanced settings but it will not reset. Is there anything I can do to get into my laptop? Read More
How to make convergence criteria for Levenberg-Marquardt algorithm
How to make convergence criteria for Levenberg-Marquardt algorithm, please give practical hint for matlab implementatioHow to make convergence criteria for Levenberg-Marquardt algorithm, please give practical hint for matlab implementatio How to make convergence criteria for Levenberg-Marquardt algorithm, please give practical hint for matlab implementatio levenberg-marquardt, convergence MATLAB Answers — New Questions
Inertia axes in an image
I have to evaluate the symmetry of this nevus, you can see his binary image.
I have found the centroid, would you give me an advise for the code to find and show the inertia axis of the image which match each other in the centroid?
I would have to align them with x and y axis of the image with a rotation then.
Thank youI have to evaluate the symmetry of this nevus, you can see his binary image.
I have found the centroid, would you give me an advise for the code to find and show the inertia axis of the image which match each other in the centroid?
I would have to align them with x and y axis of the image with a rotation then.
Thank you I have to evaluate the symmetry of this nevus, you can see his binary image.
I have found the centroid, would you give me an advise for the code to find and show the inertia axis of the image which match each other in the centroid?
I would have to align them with x and y axis of the image with a rotation then.
Thank you inertia, axis MATLAB Answers — New Questions
matlab r2014a에서 ‘gwr’은(는) 유형 ‘struct’의 입력 인수에 대해 정의되지 않은 함수입니다.
matlab r2014a에서 ‘gwr’은(는) 유형 ‘struct’의 입력 인수에 대해 정의되지 않은 함수입니다.
라고 경고문이 뜨는데 , gwr을 하기 위해서는 어떻게 해야하나요?
%=============GWR ANALYSIS========%
%=============exponential weight========%
info.dtype=’exponential’;
res1=gwr(ln_sale,x,xc,yc,info);
prt(res1, vnames);
more on;matlab r2014a에서 ‘gwr’은(는) 유형 ‘struct’의 입력 인수에 대해 정의되지 않은 함수입니다.
라고 경고문이 뜨는데 , gwr을 하기 위해서는 어떻게 해야하나요?
%=============GWR ANALYSIS========%
%=============exponential weight========%
info.dtype=’exponential’;
res1=gwr(ln_sale,x,xc,yc,info);
prt(res1, vnames);
more on; matlab r2014a에서 ‘gwr’은(는) 유형 ‘struct’의 입력 인수에 대해 정의되지 않은 함수입니다.
라고 경고문이 뜨는데 , gwr을 하기 위해서는 어떻게 해야하나요?
%=============GWR ANALYSIS========%
%=============exponential weight========%
info.dtype=’exponential’;
res1=gwr(ln_sale,x,xc,yc,info);
prt(res1, vnames);
more on; gwr, gwr struct MATLAB Answers — New Questions
I want to install an MATLAB 2024 Update 6 but it is only showing Update 2 do I have to reinstall?
I have MATLAB 2024a installed (it has update 2) — it shows that no updates are available when I check for updates in the GUI. I just received an email from MATHWORKS that I bug I reported has been fixed in UPDATE 6. When I go to the licenses to install this update, it seems to be saying that I need to uninstall the previous version and start over. Is this really what I need to do? Seems unreasonable…..I have MATLAB 2024a installed (it has update 2) — it shows that no updates are available when I check for updates in the GUI. I just received an email from MATHWORKS that I bug I reported has been fixed in UPDATE 6. When I go to the licenses to install this update, it seems to be saying that I need to uninstall the previous version and start over. Is this really what I need to do? Seems unreasonable….. I have MATLAB 2024a installed (it has update 2) — it shows that no updates are available when I check for updates in the GUI. I just received an email from MATHWORKS that I bug I reported has been fixed in UPDATE 6. When I go to the licenses to install this update, it seems to be saying that I need to uninstall the previous version and start over. Is this really what I need to do? Seems unreasonable….. update installation MATLAB Answers — New Questions
Calender doesn’t upade properly when it’s opened
So I was curious to see how the calender update its date when it’s opened and found this bug, I’ve recorded the event : click to see
So I was curious to see how the calender update its date when it’s opened and found this bug, I’ve recorded the event : click to see Read More
paretosearch does not satisfy nonlinear constraints
I want to make V<=0.001 at a position where Wn=1, but the non-linear constraint cannot do it. I am sure there is this answer. The following is my program。
https://drive.mathworks.com/sharing/df23a873-b7f8-420c-b085-dedccef7860cI want to make V<=0.001 at a position where Wn=1, but the non-linear constraint cannot do it. I am sure there is this answer. The following is my program。
https://drive.mathworks.com/sharing/df23a873-b7f8-420c-b085-dedccef7860c I want to make V<=0.001 at a position where Wn=1, but the non-linear constraint cannot do it. I am sure there is this answer. The following is my program。
https://drive.mathworks.com/sharing/df23a873-b7f8-420c-b085-dedccef7860c multi-objective optimization MATLAB Answers — New Questions
What is the maximum size of *.mat file?
What is the maximum size of *.mat file?
What is the maximum size of HDF5 file?What is the maximum size of *.mat file?
What is the maximum size of HDF5 file? What is the maximum size of *.mat file?
What is the maximum size of HDF5 file? mat file MATLAB Answers — New Questions
Is this a bug of MATLAB?
% Here is my code
[vpa(str2sym(‘asin(1)*2’),100);vpa(str2sym(‘pi’),100)]
The output is:
3.1415926535897932384626433832795
3.1415926535897932384626433832795
I think the correct answer should be longer. Is it a bug or an expected behavior?% Here is my code
[vpa(str2sym(‘asin(1)*2’),100);vpa(str2sym(‘pi’),100)]
The output is:
3.1415926535897932384626433832795
3.1415926535897932384626433832795
I think the correct answer should be longer. Is it a bug or an expected behavior? % Here is my code
[vpa(str2sym(‘asin(1)*2’),100);vpa(str2sym(‘pi’),100)]
The output is:
3.1415926535897932384626433832795
3.1415926535897932384626433832795
I think the correct answer should be longer. Is it a bug or an expected behavior? symbolic, matlab, mathematics MATLAB Answers — New Questions
Working With Inverse of Polynomials
Hello, this is my first post in this form and I am new to MatLab. I would like to take the inverse of a polynomial in factored form and express the answer in polynomial form. For example, I wish to convert 10/((x+3)^2(x+5)) in regular polynomial form.Hello, this is my first post in this form and I am new to MatLab. I would like to take the inverse of a polynomial in factored form and express the answer in polynomial form. For example, I wish to convert 10/((x+3)^2(x+5)) in regular polynomial form. Hello, this is my first post in this form and I am new to MatLab. I would like to take the inverse of a polynomial in factored form and express the answer in polynomial form. For example, I wish to convert 10/((x+3)^2(x+5)) in regular polynomial form. polynomial MATLAB Answers — New Questions
Cumulative Update for Windows 11 Insider Preview (10.0.26120.1542) (KB5041872) Install error – 0x800
@microsoft @Kerry1485 Cumulative Update for Windows 11 Insider Preview (10.0.26120.1542) (KB5041872) I have been trying to update this update for the last several days, but it always stops after reaching 100%. How do I update this Windows Insider Preview update?
@microsoft @Kerry1485 Cumulative Update for Windows 11 Insider Preview (10.0.26120.1542) (KB5041872) I have been trying to update this update for the last several days, but it always stops after reaching 100%. How do I update this Windows Insider Preview update? Read More
Simscape forces and torques: Centrifugal, gravitational, accelerative
Goodafternoon ‘u all,
I’m actually working with simscape and I was wondering if any way exist to get from a multibody model acting forces components, ad function of kinematic conditions. In simpler words, how can I get centrifugal, coriolis, gravitations, and accelerative forces components action on a mass or body of the system? Let’s assume as first approximation we’re working with rigid body (but I imagine would be in any case a good approximation also for other cases). I don’t see any evident methd for getting them easily, unless repeating all required onerous calculations (futile to say I’m not going for :-D). In robotic toolbox all these components are directly derived from internal jacobians and kinematcs conditions. I was guessing any similar feature also exist in simscape. Remarks, I’m currently using simscape under simulink environment.
Suggestions?
Best regardsGoodafternoon ‘u all,
I’m actually working with simscape and I was wondering if any way exist to get from a multibody model acting forces components, ad function of kinematic conditions. In simpler words, how can I get centrifugal, coriolis, gravitations, and accelerative forces components action on a mass or body of the system? Let’s assume as first approximation we’re working with rigid body (but I imagine would be in any case a good approximation also for other cases). I don’t see any evident methd for getting them easily, unless repeating all required onerous calculations (futile to say I’m not going for :-D). In robotic toolbox all these components are directly derived from internal jacobians and kinematcs conditions. I was guessing any similar feature also exist in simscape. Remarks, I’m currently using simscape under simulink environment.
Suggestions?
Best regards Goodafternoon ‘u all,
I’m actually working with simscape and I was wondering if any way exist to get from a multibody model acting forces components, ad function of kinematic conditions. In simpler words, how can I get centrifugal, coriolis, gravitations, and accelerative forces components action on a mass or body of the system? Let’s assume as first approximation we’re working with rigid body (but I imagine would be in any case a good approximation also for other cases). I don’t see any evident methd for getting them easily, unless repeating all required onerous calculations (futile to say I’m not going for :-D). In robotic toolbox all these components are directly derived from internal jacobians and kinematcs conditions. I was guessing any similar feature also exist in simscape. Remarks, I’m currently using simscape under simulink environment.
Suggestions?
Best regards simscape, multibody, forces MATLAB Answers — New Questions
Embed PowerPoint for Web Permissions
Hello,
Is there a way to choose ‘people in organization’ when using the Embed feature in PPT for the Web version? It looks like I can only choose certain people or groups before I use the embed code.
I don’t have access to a group for the whole organization. I don’t want to add individual names. I want to share a training presentation using the embed so anyone in the org can view it. This share link is easy to share with everyone, but I much prefer the embed method than the link method when sharing trainings.
Thank you for any help!
Debbie
Hello,Is there a way to choose ‘people in organization’ when using the Embed feature in PPT for the Web version? It looks like I can only choose certain people or groups before I use the embed code. I don’t have access to a group for the whole organization. I don’t want to add individual names. I want to share a training presentation using the embed so anyone in the org can view it. This share link is easy to share with everyone, but I much prefer the embed method than the link method when sharing trainings. Thank you for any help!Debbie Read More
Events 1020 and 1030
For 1020 it says : HNS failed to add firewall rules for new container with error ‘0x800706D9’ and unique error string “‘Windows firewall rule added successful'”
For 1030 it says : ‘IpICSHlpStopSharing’ : ‘0x80070032’.
For 1020 it says : HNS failed to add firewall rules for new container with error ‘0x800706D9’ and unique error string “‘Windows firewall rule added successful'”For 1030 it says : ‘IpICSHlpStopSharing’ : ‘0x80070032’. Read More
Plotting Complex Functions.
I intend to do a taylor series expansion at t=0. I would like to plot the coefficients of each Taylor term in the complex plane, using the surf function.
I tried Taylor(F) , Series (F) somewhere there is an error. The function is product of two gaussians, with two parameters mentioned above. This Gaussian contains other constants, Some are symbolic, while some have pre determined values.
Can some one help me out.
Thanks.I intend to do a taylor series expansion at t=0. I would like to plot the coefficients of each Taylor term in the complex plane, using the surf function.
I tried Taylor(F) , Series (F) somewhere there is an error. The function is product of two gaussians, with two parameters mentioned above. This Gaussian contains other constants, Some are symbolic, while some have pre determined values.
Can some one help me out.
Thanks. I intend to do a taylor series expansion at t=0. I would like to plot the coefficients of each Taylor term in the complex plane, using the surf function.
I tried Taylor(F) , Series (F) somewhere there is an error. The function is product of two gaussians, with two parameters mentioned above. This Gaussian contains other constants, Some are symbolic, while some have pre determined values.
Can some one help me out.
Thanks. complex intergaration, taylor series MATLAB Answers — New Questions