Please help me understand what happens to the matrices bellow

1 view (last 30 days)
Hi All
I have a matrix t [3 1000]
and then these lines :
y00 = repmat( mean(t,2), 1, size(t,2))
MSE00 = mse( t - y00 )
MSE00 = mean(var(t',1))
nperf = mse(t-y)/MSE00
what does each line do ??
  4 Comments
Roger Stafford
Roger Stafford on 15 Mar 2015
The line "repmat( mean(t,2), 1, size(t,2))" first takes the mean value of each of the three rows of matrix 't', giving a 3-by-1 column vector as a result. Then the 'repmat' operator repeats this vector along the second dimension so that it is again of size 3-by-1000. Each of its thousand columns will then be the same.
dpb
dpb on 15 Mar 2015
NB: that bsxfun will allow writing the following lines w/o the explicit expansion, too...highly recommended as long as the version in use incorporates it (which is getting to be quite some time ago now altho I don't recall just when that was).

Sign in to comment.

Accepted Answer

Greg Heath
Greg Heath on 16 Mar 2015
The significance of the code is that MSE00 is a very special reference normalization value for mean-square-error.
Consider a net that yields the same output, regardless of input. Given a target matrix, what constant will minimize mean-square error?
When you work it out you will find that the constant should be the row-wise mean value of the target matrix.
Furthermore, the corresponding minimum mean-square-error is just the mean of the biased (i.e., divide by N, not N-1) row-wise variances.
If you consider the mean variance as a measure of how much information is in the target, the normalized MSE of any design
NMSE = mse(target-output)/MSE00
is a measure of the fraction of that target information that is NOT modelled by the design and correspondingly the coefficient of determination
Rsquare = 1- NMSE
is a measure of the fraction of that target information that IS modelled by the design.
http://en.wikipedia.org/wiki/Coefficient_of_determination
I typically try to obtain a Rsquare value that corresponds to modeling at least 99% of the mean target variance.

More Answers (0)

Categories

Find more on Operators and Elementary Operations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!