I have a function, where I calculate a prediction with the shape 1 x 250. I do this B times. To save all predictions for the B runs I would like to fill an empty B x 250 matrix row wise. Which python method is the best to fill an empty matrix, so that I can access the rows in a simple way (for example to subtract the rows from each other)
There must be something better then the following
indx = np.argsort(y_real[:,1])
print(len(indx)) #250
hat_y_b = []
for b in range(0,B):
y_pred = function()
hat_y_b = np.append(hat_y_b, y_pred[indx,1], axis=0)