0

I have 2 classes that both follow multivariable normal distribution, the first with $$\mu_1 = [-1,-1], \Sigma_1=\begin{bmatrix}0.4&0\\0&0.4\end{bmatrix} $$ and the second with $$\mu_2=[1,1],\Sigma_2=\begin{bmatrix}0.4&0\\0&0.4\end{bmatrix}$$

Im trying to program in python a linear classifier using Fisher's LDA. So first step was to calculate the "within classes variance matrix" $S_W$. This quantity is "officialy" defined, in my case, as $$S_W = \sum_{i=1}^2\sum_{n=1}^N(x_n^i - \mu_i)(x_n^i - \mu_i)^T$$

My first question is, can this matrix be written also as $S_W = \Sigma_1 + \Sigma_2$? I thought it was possible to do it, but after programming the computation of $S_W$ using the first formula, it doesn't yield the same result with the second formula, which uses the covariance matrices. So the 2 expressions arent equivalent. If this is true, are there any special cases where these 2 are equivalent?

Am I missing something? Thanks in advance!

thenac
  • 291
  • 3
  • 10
  • Why is that not answered here https://stats.stackexchange.com/questions/8625/deriving-total-within-class-between-class-scatter-matrix?rq=1 ? What I mean is how is your question asking for something else than the formula provided in that question? – Jesper for President Dec 28 '19 at 16:47
  • My main question is if the 2 formulas i gave for $S_W$ are equivalent or not. And if not, in which cases they are – thenac Dec 28 '19 at 17:24

0 Answers0