I have all_data as a numpy array with the size of (2,601), NUM_SAMPLES = 601 and NUM_CLUSTERS = 3.
Is there any vector form to build f (a (601,9) numpy array) than what using nested for-loops as follows?
f = np.empty((0,9), float)
for n in range(NUM_SAMPLES):
f_n = np.array([[]])
for m in range(NUM_CLUSTERS):
f_n = np.hstack( (f_n , z_i(alldata[:,n], m).T))
f = np.concatenate((f, f_n) , axis=0)
NOTE : when recalling function z_i(alldata[:,n], m), it returns a (3,1) numpy array.
f is supposed to be 'F' in the following formula:
formula of f
z_i.3xnarray or given an array and amcreates a3m xnor something like thatz_ihas to be called once for each combination ofnandm.? And it's a relatively slow python function? That's your bottleneck!