I'm writing a code to analyze outliers with KNN, when I make the matrix (70k x 70k)it is too big for my RAM (36GB) so I separated them in 7 matrices of 10k x 10k elements with the next code:
matrices = []
for i in range(7):
matrices.append(np.zeros([10000, 10000]))
for matrix in matrices:
for i in range(10000 * matrices.index(matrix), 10000 * (matrices.index(matrix) + 1)):
for j in range(10000 * matrices.index(matrix), 10000 * (matrices.index(matrix) + 1)):
distance = mt.sqrt((x[i] - x[j]) ** 2 + (y[i] - y[j]) ** 2)
matrix[i, j] = round(distance, 3)
but when I run it (of course 25 minutes later) it shows the next error:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
In the line for i in range(10000 * matrices.index(matrix), 10000 * (matrices.index(matrix) + 1)):
I can´t find anything about this, since I'm not actually asking for the truth value.
(It's for a hw and don't have the time to learn and use pytables)