Skip to content

Commit

Permalink
Merge pull request #477 from rasbt/sorteigvec
Browse files Browse the repository at this point in the history
Sort eigvecs in PCA
  • Loading branch information
rasbt committed Dec 3, 2018
2 parents a4bcab8 + 25adf46 commit 4a9e5e0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/sources/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The CHANGELOG for the current development version is available at

##### Bug Fixes

- -
- The eigenvectors maybe have not been sorted in certain edge cases if solver was `'eigen'` in `PrincipalComponentAnalysis`. ([#477](https://github.com/rasbt/mlxtend/pull/477))



Expand Down
2 changes: 1 addition & 1 deletion mlxtend/feature_extraction/principal_component_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def _decomposition(self, mat, n_samples):
e_vals = e_vals ** 2 / n_samples

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 _loadings(self):
Expand Down

0 comments on commit 4a9e5e0

Please sign in to comment.