shogun-toolbox / shogun

Shōgun
http://shogun-toolbox.org
BSD 3-Clause "New" or "Revised" License
3.03k stars 1.04k forks source link

Kernel PCA test/check #940

Open karlnapf opened 11 years ago

karlnapf commented 11 years ago

Kernel PCA seems to do strange things, in this easy task you could

Create meaningful data for kPCA for python example compare against other implementation with same data/parameters in unit-test, update integration test (easy)

If anything is unclear, ask!

vikkamath commented 11 years ago

Can you explain what you mean by "strange things".

karlnapf commented 11 years ago

The integration test recently failed. preprocessor_kernelpca_modular in python modular This means that the projection changed from when the test was created. Unfortunately, the example does not use sensible data which a human could check visually. I recently created such an example and noticed that the projection did not look as I expected it to. Since I was in a hurry, I investigated no further.

If you could write a simple but meaningful example in python that demonstrates that KPCA works as it should, we could update the old integration test. More importantly, if you could write a unit test for KPCA which for example checks the projection of a small toy example to be correct, this would be even better.

deerishi commented 11 years ago

. we have to implement the kernel pca algorithm in python without using the shogun libraries rite?

karlnapf commented 11 years ago

No, no.

1.) Create an example for kernelPCA which illustrates the algorithm on meaningful data. This means one should see (if plotted) what the method does. If this is reasonable, the integration test should be updated (ask for that its easy). Challenge here is to create a nice example since for this you have to somehow understand kernel PCA

2.) Create a unit test in c++. This means you should create a simple test case for which you can compute the results somehow else (best is another implementation which you trust, or derived by hand even better). Then assert the results of shogun's kernel PCA against this reference.

deerishi commented 11 years ago

so we just need to make a test sample?could you explain the integration test?

karlnapf commented 11 years ago

don't worry about the integration test for now. It is just this: Once the test works, make sure it is reproducible, then save results to a file (we have a script for this), then everytime the example is run, it is checked that the results match with those in the file. But this all comes after the example works.

deerishi commented 11 years ago

I have implemented the KPCA algorithim in python and it is giving me good results. https://github.com/deerishi/KernelPCA-test-check/commit/743d3d9bc373aa36b0ea4bb7065ed36ba8706a93