I'm trying to extract from a 3D matrix of values a 2d matrix were the last dimension has values from the last dimension of the 3d matrix. For example if P of dimensions [2,2,3] =
[
[[5, 1, 5], [9, 9, 4]],
[[0, 9, 8], [8, 6, 8]]
]
what is the index matrix in order to get the out matrix
[[1, 9],[0, 8]] where 1 is the 2nd element of the first column of the first row, 9 is the 1st element of the first row second column, 0 is the 1st element of the second row first column and 8 is the 3rd element of the second row second column?
The idea is that, for each column I have k different scores. I want to retrieve for each column a different score for which I know the index.
I'm a bit confused with advanced indexing in Numpy and I'm not figuring it out by my self. Thanks!
2nd element, 1st element, 1st element & 3rd element? Or is it given as a separate indexing variable?Pand the matrixoutwhat is the matrixIsuch thatP[I] = out? I understand thatIcould be actually an expression for indexing or advanced indexing in numpy. What I mean is that I know which index I have to pick from P, what I don't know is how to index P in the correct way to have the right output.P.