I have:
{moderator edit - solution code removed}
[[10.05051235 2.0828533 -0.48089952 -4.97268808]
[ 2.0828533 10.89214084 5.0277819 3.98804526]
[-0.48089952 5.0277819 9.98912851 2.14735945]
[-4.97268808 3.98804526 2.14735945 11.02674517]]
(4, 4)
<class ‘numpy.ndarray’>
target_index: 1
relevant_indices: [0 1 2 3]
highest_covariances: [0 3 2 1]
AssertionError Traceback (most recent call last)
Input In [13], in <cell line: 15>()
12 foo = samples.reshape(60, 128, samples.shape[-1])
14 relevant_indices, highest_covariances = get_top_covariances(foo, 1, top_n=3)
—> 15 assert (tuple(relevant_indices) == (2, 3, 0)), “Make sure you’re getting the greatest, not the least covariances”
16 assert np.all(np.abs(highest_covariances - [5, 4, 2]) < 0.5 )
18 relevant_indices, highest_covariances = get_top_covariances(foo, 0, top_n=3)
AssertionError: Make sure you’re getting the greatest, not the least covariances
The indices are wrong. In target indexes there are: [ 2.0828533 10.89214084 5.0277819 3.98804526]. So, the order for the highest indexes are: 1,2,3,0 and the highest values are: 10.89, 5, 3.99, 2.08 . What is causing this error?