I documenti indicano che numpy.correlate
non è quello che stai cercando:
numpy.correlate(a, v, mode='valid', old_behavior=False)[source]
Cross-correlation of two 1-dimensional sequences.
This function computes the correlation as generally defined in signal processing texts:
z[k] = sum_n a[n] * conj(v[n+k])
with a and v sequences being zero-padded where necessary and conj being the conjugate.
Invece, come gli altri commenti suggerito, siete alla ricerca di un Pearson correlation coefficient. Per fare questo con prova SciPy:
from scipy.stats.stats import pearsonr
a = [1,4,6]
b = [1,2,3]
print pearsonr(a,b)
Questo dà
(0.99339926779878274, 0.073186395040328034)
È anche possibile utilizzare numpy.corrcoef
:
import numpy
print numpy.corrcoef(a,b)
Questo dà:
[[ 1. 0.99339927]
[ 0.99339927 1. ]]
veda la risposta @lgautier [ qui] http://stackoverflow.com/a/15026044/1982962) –
Hai provato corrcoef: http: //docs.scipy.org/doc/numpy/reference/generated/numpy.corrcoef.html – Dan