ysig / GraKeL

A scikit-learn compatible library for graph kernels
https://ysig.github.io/GraKeL/
Other
587 stars 96 forks source link

Weisfeiler Lehman kernel fitting process #9

Closed tvayer closed 5 years ago

tvayer commented 5 years ago

Hello,

I'm using the grakel library (thank you for the very clear documentation and the gathering work !) in order to make classification. But i'm confused about some results I have regarding the Weisfeiler Lehman kernel.

For what I understand about the kernel is that there is no "learning" process : if we fit the kernel on the entire dataset or a subset we should have the same result about the pairwise similarities between the graphs.

However when I run the following code I'm not getting the same kernel at the end. First I fit_transform on all Mutag data getting a K_from_all kernel and then I select a subset (with respect to train and test indices) of this kernel.

I then compare with the same kernel but fitted on a small subset of the data (with respect to the train subset) and transformed on the test subset. I'm getting a K_from_small kernel which is different from the K_from_all kernel :

capture d ecran 2018-11-13 a 18 17 55

Did I miss details about the fitting procedure of the kernel ? (for the shortest path kernel I recover the same kernels)

Thank you very much

Titouan

ysig commented 5 years ago

Good morning (from this side of the world)!

This was a small error inside the Weisfeiler Lehman transform(), that had as a result that labels, that where not found at fit(), could be assigned a new label that was already assigned.

This and other changes can be found on branch 0.1a6, concerning this and other changes in grakel.

Thanks a lot for your feedback.

tvayer commented 5 years ago

All right thank you very much !