This commit is contained in:
Dominik Moritz Roth 2022-02-24 20:18:31 +01:00
parent 0dc40c5635
commit 85c800d39e

View File

@ -1,4 +1,6 @@
import numpy as np
from node2vec import Node2Vec
from sklearn.gaussian_process.kernels import Kernel, Hyperparameter
from sklearn.gaussian_process.kernels import GenericKernelMixin
from sklearn.gaussian_process import GaussianProcessRegressor
@ -12,7 +14,7 @@ class BookKernel(GenericKernelMixin, Kernel):
self.G = G
self.node2vec = Node2Vec(self.G, dimensions=32, walk_length=16, num_walks=256, workers=8)
self.model = node2vec.fit(window=10, min_count=1, batch_words=4)
self.model = self.node2vec.fit(window=10, min_count=1, batch_words=4)
self.wv = self.model.wv
def _f(self, s1, s2):