Why didnt get the same result even when using RNG function?

3 次查看(过去 30 天)
Hello everyone,
I utilized the RNG (Random Number Generator) function to ensure result reproducibility when employing the entire matrix in CNN . However, upon selecting just two columns of the matrix and rerunning the code several times, I did not obtain the same result consistently. With the entire matrix, I consistently achieved the same result. Ps: I am using parallel environment.
rng(0);
appp=mfcc_matrix_app;
testt=mfcc_matrix_test;
% CNN code
%always get the same result
However, when I select just two columns and rerun the code several times, I didn't get the same result.
rng(1);
t=[1,2];
for j =1:length(t)
appp = mfcc_matrix_app(:, t(1:end)) ;
testt = mfcc_matrix_test(:, t(1:end)) ;
% CNN code
%didnt get the same accuracy
end
would anyone help me please! thanks in advance.

回答(1 个)

Steven Lord
Steven Lord 2023-11-16
Suppose you stack a deck of cards in a particular way. You then play a hand of standard five-card draw poker with 3 players. You deal out 5 cards to each player, meaning that the first card to be dealt during the draw phase is the 16th in the deck.
Then you stack the deck the exact same way to play the next hand, but one of the players steps away from the table to take a phone call. You deal out 5 cards to each player, meaning that the first card to be dealt during the draw phase is the 11th in the deck.
The results of the two hands won't be identical even though the deck was in the same state before each hand.
What guarantee do you have that the CNN code generates the exact same quantity of random numbers in each case, if the number of random numbers it requires is based on how much data you have?
  2 个评论
Hamza
Hamza 2023-11-16
@Steven Lord Thank a lot for your response. I agree with your point. However, what I didnt understand is that while I achieved 85% accuracy consistently using the entire matrix with rng(0), upon selecting only one column with rng(1) and running it multiple times, I obtained varying results. This outcome seems illogical as it should ideally remain constant, similar to the performance of the entire matrix.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Deep Learning Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by