You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use the calculate_correlation_matrix, and the result is greater than 1. is there any wrong?
it is convariance_matrix = (1 / (n_sample - 1)) * (X - X.mean(0)).T.dot(Y - Y.mean(0))?
is there some meaningful thing when the relation is greater than 1?
every function called has been tested. I think all are right. x = np.array(np.random.random((10, 4))) print(calculate_variance(x)) print(calculate_std_dev(x)) print(calculate_convariance_matrix(x)) print(calculate_correlation_matrix(x))
Yes, the diagonal values in the correlation matrix should be 1. I have compared my methods to the corresponding numpy implementations, and the scaling factor in calculating the correlation matrix should have been 1/N instead of 1/(N-1) (used in calculating the covariance matrix).
I use the calculate_correlation_matrix, and the result is greater than 1. is there any wrong?
it is convariance_matrix = (1 / (n_sample - 1)) * (X - X.mean(0)).T.dot(Y - Y.mean(0))?
is there some meaningful thing when the relation is greater than 1?
every function called has been tested. I think all are right.
x = np.array(np.random.random((10, 4))) print(calculate_variance(x)) print(calculate_std_dev(x)) print(calculate_convariance_matrix(x)) print(calculate_correlation_matrix(x))
the result is
[ 0.06257289 0.0854199 0.08613444 0.04435951]
[ 0.25014574 0.29226683 0.2934867 0.21061698]
[[ 0.06952543 -0.00037733 0.00416579 0.01641681]
[-0.00037733 0.094911 -0.02781782 0.0075379 ]
[ 0.00416579 -0.02781782 0.09570494 0.02909376]
[ 0.01641681 0.0075379 0.02909376 0.04928835]]
[[ 1.11111111 -0.00516115 0.05674344 0.31160352]
[-0.00516115 1.11111111 -0.32430615 0.1224553 ]
[ 0.05674344 -0.32430615 1.11111111 0.47067173]
[ 0.31160352 0.1224553 0.47067173 1.11111111]]
The text was updated successfully, but these errors were encountered: