How to calaculate This standard deviation correction factor in Matlab?

3 次查看(过去 30 天)
Hello guys,
i want to normalize my dta matrix by using the below formula.
could anyone help me to write the approriate piece of code for that, if that possible?
Normalization_formula.jpg
where g(i,j) is the value for feature i in sample j, sd(g(i)) is the standard deviation across samples for feature i, sd10(g) is the 10-percentile value of standard deviations across features.
My data matrix is looks like this which have 8 features and 16 samples in this example
my_data_matrix.jpg
I appreciate any help!
  17 个评论
Steven Lord
Steven Lord 2020-1-13
If the data is that large, how about posting a smaller subset of the data (say a dozen or so rows) and telling us what you would expect the answer to be for that smaller subset of data.
For example, let's take this sample dataset. What would you expect to be for it?
rng default % Make sure we can each create the same A
A = randn(12, 8);
chocho
chocho 2020-1-13
@Steven Lord so sorry for that , i share a subset of it just to show how it looks like and whats the nature of the values on it, however my data is of size 219*25172

请先登录,再进行评论。

回答(1 个)

Guillaume
Guillaume 2020-1-13
I think you first need to clarify what is meant by "the 10-percentile value of standard deviations across features". I very much doubt it's the 10th of the standard deviation and obviously it's going to greatly influence your results.
However, since we don't know, here is the implementation with 1/10 of the standard deviation:
%input: g a NxM matrix, where rows are samples, columns are feature
result = g ./ (std(g, 0, 1) + 0.1*std(g, 0, 'all')); %R2018b or later
%result = g ./ (std(g, 0, 1) + 0.1*std(g(:))); %R2016b or later
%result = bsxfun(@rdivide, g, std(g, 0, 1) + 0.1*std(g(:))); %prior to R2016b
  2 个评论
chocho
chocho 2020-1-13
编辑:chocho 2020-1-13
Hi @Guillaume as it attached in the mathematical formula above is written sd10 so may be what you exactly supposed ?
im going to try your code and thanks alot for your cooperation

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by