mnick / holographic-embeddings

Code for experiments in the AAAI 2016 paper "Holographic Embeddings of Knowledge Graphs"
173 stars 50 forks source link

TypeError: slice indices must be integers or None or have an __index__ method #6

Open SeekPoint opened 7 years ago

SeekPoint commented 7 years ago

mldl@mldlUB1604:~/ub16_prj/holographic-embeddings$ bash run_transe_wn18.sh INFO:EX-KG:Fitting model TransE with trainer PairwiseStochasticTrainer and parameters Namespace(fin='data/wn18.bin', fout=None, init='nunif', lr=0.1, margin=2.0, me=500, mode='rank', nb=100, ncomp=50, ne=1, no_pairwise=False, sampler='random-mode', test_all=50) Traceback (most recent call last): File "kg/run_transe.py", line 41, in ExpTransE().run() File "/home/mldl/ub16_prj/holographic-embeddings/kg/base.py", line 50, in run self.train() File "/home/mldl/ub16_prj/holographic-embeddings/kg/base.py", line 154, in train trn.fit(xs, ys) File "/usr/local/lib/python3.5/dist-packages/scikit_kge-0.1-py3.5.egg/skge/base.py", line 197, in fit scores_o = self.scores_o(mdl, s, p).flatten() File "/usr/local/lib/python3.5/dist-packages/scikit_kge-0.1-py3.5.egg/skge/base.py", line 142, in _optim sampler = sample.RandomModeSampler(self.args.ne, [0, 1], xs, sz) File "/usr/local/lib/python3.5/dist-packages/numpy/lib/shape_base.py", line 509, in split res = array_split(ary, indices_or_sections, axis) File "/usr/local/lib/python3.5/dist-packages/numpy/lib/shape_base.py", line 430, in array_split sub_arys.append(_nx.swapaxes(sary[st:end], axis, 0)) TypeError: slice indices must be integers or None or have an index method mldl@mldlUB1604:~/ub16_prj/holographic-embeddings$

StevenLOL commented 7 years ago

in scikit-skge/skge/base.py line 130

change

self.batch_size = np.ceil(len(xys) / self.nbatches)

to

self.batch_size = np.int(np.ceil(len(xys) / self.nbatches))