hexiangnan / neural_collaborative_filtering

Neural Collaborative Filtering

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

when run your code , it occurs some problems.

sshzhang opened this issue · comments

Connected to pydev debugger (build 182.4323.49)
Using Theano backend.
MLP arguments: Namespace(batch_size=256, dataset='ml-1m', epochs=100, layers='[64,32,16,8]', learner='adam', lr=0.001, num_neg=4, out=1, path='Data/', reg_layers='[0,0,0,0]', verbose=1)
Load data done [46.5 s]. #user=6040, #item=3706, #train=994169, #test=6040
Traceback (most recent call last):
File "/home/zxj/software/pycharm-2018.2.3/helpers/pydev/pydevd.py", line 1664, in
main()
File "/home/zxj/software/pycharm-2018.2.3/helpers/pydev/pydevd.py", line 1658, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "/home/zxj/software/pycharm-2018.2.3/helpers/pydev/pydevd.py", line 1068, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "/home/zxj/software/pycharm-2018.2.3/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/home/zxj/PycharmProjects/neural_collaborative_filtering/MLP.py", line 136, in
model = get_model(num_users, num_items, layers, reg_layers)
File "/home/zxj/PycharmProjects/neural_collaborative_filtering/MLP.py", line 72, in get_model
user_latent = Flatten()(MLP_Embedding_User(user_input))
File "/usr/local/lib/python3.5/dist-packages/keras/engine/topology.py", line 484, in call
self.build(input_shapes[0])
File "/usr/local/lib/python3.5/dist-packages/keras/layers/embeddings.py", line 95, in build
name='{}_W'.format(self.name))
File "/home/zxj/PycharmProjects/neural_collaborative_filtering/MLP.py", line 57, in init_normal
return initializations.normal(shape, scale=0.01, name=name)
File "/usr/local/lib/python3.5/dist-packages/keras/initializations.py", line 36, in normal
return K.random_normal_variable(shape, 0.0, scale, name=name)
File "/usr/local/lib/python3.5/dist-packages/keras/backend/theano_backend.py", line 115, in random_normal_variable
return variable(np.random.normal(loc=0.0, scale=scale, size=shape),
File "mtrand.pyx", line 1652, in mtrand.RandomState.normal
File "mtrand.pyx", line 242, in mtrand.cont2_array_sc
TypeError: 'float' object cannot be interpreted as an integer

The are some problems, when i run MLP.py , keras and Theano version is right . I hope you can hope me to solved this problems

I solved it . modify int(layers[0]/2) That would be ok !

Hello,where did you modify?

MLP文件中的Embedding(output_dim=int(layers[0]/2)) ,两个Embedding都要修改。

thank you very much,but i meet the error:
ERROR (theano.gof.opt): Optimization failure due to: constant_folding
ERROR (theano.gof.opt): node: DimShuffle{x,x}(TensorConstant{0.5})
ERROR (theano.gof.opt): TRACEBACK:
ERROR (theano.gof.opt): Traceback (most recent call last):
File "C:\Users\Administrator\Anaconda3\lib\site-packages\theano\gof\opt.py", line 1772, in process_node
replacements = lopt.transform(node)
File "C:\Users\Administrator\Anaconda3\lib\site-packages\theano\tensor\opt.py", line 5825, in constant_folding
no_recycling=[])
File "C:\Users\Administrator\Anaconda3\lib\site-packages\theano\gof\op.py", line 970, in make_thunk
no_recycling)
File "C:\Users\Administrator\Anaconda3\lib\site-packages\theano\gof\op.py", line 879, in make_c_thunk
output_storage=node_output_storage)
File "C:\Users\Administrator\Anaconda3\lib\site-packages\theano\gof\cc.py", line 1200, in make_thunk
keep_lock=keep_lock)
File "C:\Users\Administrator\Anaconda3\lib\site-packages\theano\gof\cc.py", line 1143, in compile
keep_lock=keep_lock)
File "C:\Users\Administrator\Anaconda3\lib\site-packages\theano\gof\cc.py", line 1587, in cthunk_factory
key = self.cmodule_key()
File "C:\Users\Administrator\Anaconda3\lib\site-packages\theano\gof\cc.py", line 1285, in cmodule_key
c_compiler=self.c_compiler(),
File "C:\Users\Administrator\Anaconda3\lib\site-packages\theano\gof\cc.py", line 1364, in cmodule_key_
numpy.core.multiarray._get_ndarray_c_version())
AttributeError: module 'numpy.core.multiarray' has no attribute '_get_ndarray_c_version'
I hope you can hope me to solved this problems

Please use python2 to run the code.(The gap between python3 and python2)