log_class_priors = np.zeros(2) count = 0 for i in range(num): #iterate over samples if data[i,0]==1: count+=1 #if the sample is in class 1 increment log class_prior[0] = np.log((num-count)/num) log_class_priors[1] = np.log(count/num) code example
Example: how to print a number at the end of a for loop in python
for i in range(1,4):
if i == 3:
print(i)