归一化互相关(转自https://anomaly.io/understand-auto-cross-correlation-normalized-shift/index.html)
Normalized Cross-Correlation
There are three problems with cross-correlation:
It is difficult to understand the scoring value.
Both metrics must have the same amplitude. If Graph B has the same shape as Graph A but values two times smaller, the correlation will not be detected.
corr(a, a/2) = 19.5
Due to the formula, a zero value will not be taken into account, since 00=0 and 0200=0.
To solve these problems we use normalized cross-correlation:
Using this formula let’s compute the normalized cross-correlation of AB and AC.
Graphs A and B correlate, with a high value of 0.947.
Graphs A and C don’t correlate, showing a low value of -0.157.
Normalized cross-correlation scoring is easy to understand:
– The higher the value, the higher the correlation is.
– The maximum value is 1 when two signals are exactly the same:
norm_corr(a,a)=1
– The minimum value is -1 when two signals are exactly opposite:
norm_corr(a, -a) = -1
Normalized cross-correlation can detect the correlation of two signals with different amplitudes: norma_corr(a, a/2) = 1.
Notice we have perfect correlation between signal A and the same signal with half the amplitude!