Skip to content
Advertisement

More pythonic way of creating within-class scatter matrix

I am looking for a better way of calculating the following

JavaScript

I would prefer getting rid of the for loops using numpy.

This is the within-class scatter matrix for fischers linear discriminant.

Advertisement

Answer

You can write as follows:

JavaScript

This is because sum_i x_i x'_i = X' X, where X is (N, 3) matrix and x_i = X[i,:], i.e. i-th row of X. ' indicates the transpose.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement