You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That should be $n_i - 1$, which is what np.cov uses to get an unbiased estimator.
Then in Chpt. 5, pg. 158 the within-class scatter matrix S_W is calculated as:
d=13# number of featuresS_W=np.zeros((d, d))
forlabel,mvinzip(range(1, 4), mean_vecs):
class_scatter=np.cov(X_train_std[y_train==label].T)
S_W+=class_scatter
The covariances are not being weighted by sample sizes. The correct implementation is:
In Chpt. 5, pg. 157 it says:
That should be$n_i - 1$ , which is what
np.cov
uses to get an unbiased estimator.Then in Chpt. 5, pg. 158 the within-class scatter matrix
S_W
is calculated as:The covariances are not being weighted by sample sizes. The correct implementation is:
The text was updated successfully, but these errors were encountered: