Closed nbl97 closed 3 years ago
You will have to look at the code of Weisfeiler Lehman in more detail.
Indeed there are properties which are calculated.
As you noticed fit returns the self
object, which is firstly a scikit-learn compatibility detail and secondly something that allows chaining operations.
If you look at the definition of weisfeiler-lehman:
X : dict
Holds a dictionary of fitted subkernel modules for all levels.
Now depends on the subkernel you use. If it is the default, you should access the features for each level with something like:
graph_kernel = WL(...)
graph_kernel.fit(X)
features = dict()
for level, base_graph_kernel in graph_kernel.X:
features[level] = base_graph_kernel.X
The documentation said the
fit()
function extracts that. However, I try to print the result offit()
byprint(wl_kernel.fit([G1,G2]))
and just got the "WeisfeilerLehman(n_iter=1, normalize=True)" in the screen. I am sure that the graph G1, G2, and the WeisfeilerLehman kernel are built correctly. I want to calculate the Jaccard similarity of two graphs by the feature of WL kernel, so printing the feature is necessary. Please help me! Thanks a lot!