Skip to content
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

RuntimeWarning in pca.py #2

Open
stepenik opened this issue Jan 24, 2017 · 5 comments
Open

RuntimeWarning in pca.py #2

stepenik opened this issue Jan 24, 2017 · 5 comments

Comments

@stepenik
Copy link

Hi,
When you start program in the pca.py I see error RuntimeWarning

RuntimeWarning: invalid value encountered in sqrt
S = np.sqrt(e[::-1]) # reverse since eigenvalues are in increasing order

https://github.com/povilasb/eigenfaces/blob/11f93098eabd4f16d21f40eb5173628eec9d6bef/pca.py#L23

Do you know how to fix that. This is not critical bug :)

@stepenik stepenik changed the title RuntimeWarning in pcy.py RuntimeWarning in pca.py Jan 24, 2017
@povilasb
Copy link
Owner

Not really, I forked eigenfaces from https://github.com/antonyross/eigenfaces.
I'll take a look at it anyway :)

@stepenik
Copy link
Author

Ok thank you :)

@stepenik
Copy link
Author

Do you looked this file :) .... Any news?

@povilasb
Copy link
Owner

Yes, the problem lays here https://github.com/povilasb/face-recognition/blob/master/facerecognition/eigenfaces/pca.py#L23

Basically I try to do square root for e vector:

 S = np.sqrt(e[::-1]) 

but one of e values is negative.

The easiest wayt to fix this would be to abs the vector e values.
But I'm not sure if that would make sense regarding PCA algorihtm.
I don't really understand it yet.

@stepenik
Copy link
Author

stepenik commented Aug 4, 2017

Yes I am now test your case. If I put S = np.sqrt(np.abs(e[::-1])) in eigenface min_distance is higher.
For example if you dont put np.abs() min_distance is between 5600-6100. If you put np.abs() min_distance is between 6100-6500.
And I think it is better without np.abs()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants