[Solved] can’t multiply matrix and list which type ‘float’


You are multiplying a list by a float. You should multiply each row of the matrix with words. Something like this will work.

multiply_nonspam_test = []
for row in transpose_test_feature:
  multiply_nonspam_test.append([x*y for x,y in zip(row, log_train_probs_nonspam_words)])

print multiply_nonspam_test

0

solved can’t multiply matrix and list which type ‘float’