New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linear Discriminant Analysis #88
Comments
in LDA, we can refactor the predict method by NumPy built-ins to a more readable and performant version ML-From-Scratch/mlfromscratch/supervised_learning/linear_discriminant_analysis.py Lines 37 to 43 in a2806c6
is equal to this def predict(self, X):
return np.array([1 * (x.dot(self._w) < 0) for x in X], dtype=np.int) which can be implemented like this def predict(self, X):
return np.where(X.dot(self._w) < 0, 1, 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
First of all thanks for the great reference, you've been created and it performs well in its current format.
But, Is it acceptable to use covariance matrices instead of scatter matrices in LDA?
shouldn't it use scatter matrices?
ML-From-Scratch/mlfromscratch/supervised_learning/linear_discriminant_analysis.py
Lines 24 to 25 in a2806c6
As we know the relation between these two matrices is
scatter(X) = X.T.dot(X)
covariance(X) = X.T.dot(X) / N
for a given X or
X = X - mean(X)
andN = |X|
reference
The text was updated successfully, but these errors were encountered: