Skip to content

Commit

Permalink
sort eigvecs in lda
Browse files Browse the repository at this point in the history
  • Loading branch information
rasbt committed Dec 3, 2018
1 parent c9c949b commit cc90313
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion docs/sources/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ The CHANGELOG for the current development version is available at

- Changed the default solver in `PrincipalComponentAnalysis` to `'svd'` instead of `'eigen'` to improve numerical stability. ([#474](https://github.com/rasbt/mlxtend/pull/474))


##### Bug Fixes

- -
- The eigenvectors maybe have not been sorted in certain edge cases in `LinearDiscriminantAnalysis`. ([#478](https://github.com/rasbt/mlxtend/pull/478))



Expand Down
2 changes: 1 addition & 1 deletion mlxtend/feature_extraction/linear_discriminant_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def _eigendecom(self, within_scatter, between_scatter):
e_vals, e_vecs = np.linalg.eig(np.linalg.inv(within_scatter).dot(
between_scatter))
sort_idx = np.argsort(e_vals)[::-1]
e_vals, e_vecs = e_vals[sort_idx], e_vecs[sort_idx]
e_vals, e_vecs = e_vals[sort_idx], e_vecs[:, sort_idx]
return e_vals, e_vecs

def _projection_matrix(self, eig_vals, eig_vecs, n_discriminants):
Expand Down

0 comments on commit cc90313

Please sign in to comment.