Coder Social home page Coder Social logo

akirazc / catn Goto Github PK

View Code? Open in Web Editor NEW
39.0 6.0 7.0 12 KB

The implementation of SIGIR 2020 paper "CATN: Cross-Domain Recommendation for Cold-Start Users via Aspect Transfer Network“, Cheng Zhao, Chenliang Li, Rong Xiao, Hongbo Deng and Aixin Sun

Python 100.00%

catn's Introduction

CATN

Codes for SIGIR 2020 paper CATN: Cross-Domain Recommendation for Cold-Start Users via Aspect Transfer Network.

Citation

Please cite our paper if you find this code useful for your research:

@inproceedings{sigir20:catn,
  author    = {Cheng Zhao and
               Chenliang Li and
               Rong Xiao and
               Hongbo Deng and
               Aixin Sun},
  title     = {{CATN:} Cross-Domain Recommendation for Cold-Start Users via Aspect
               Transfer Network},
  booktitle = {{SIGIR}},
  year      = {2020},
}

Requirement

  • python 3.6
  • tensorflow 1.10.0
  • numpy
  • pandas
  • scipy
  • gensim
  • sklearn
  • tqdm

Files in the folder

  • dataset/
    • preprocessing.py: constructing cross-domain datasets;
  • runner/
    • CATN_runner.py: the main runner (including the configurations);
  • utils
    • CATN.py: CATN implementation.

Running the code

  1. Download the original data from Amazon-5core, choose two relevant categories (e.g., Books, Movies and TV) and put them under the same directory in dataset/.

  2. run python preprocessing.py.

  3. run python CATN_runner.py.

catn's People

Contributors

akirazc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar tc.lin (德全) avatar Qiyao Wu avatar pingjunpan avatar CHEN LEI avatar  avatar Wei Song avatar Empsure avatar  avatar  avatar peco avatar xuqiang avatar caojiangxia avatar Anmol Deep avatar  avatar YRY avatar  avatar dailing avatar  avatar  avatar  avatar Tianyu Chen avatar  avatar 52Pig(Michaux) avatar  avatar  avatar Zhaoyue Cheng avatar Jin Yao avatar  avatar onecall avatar  avatar  avatar  avatar  avatar  avatar

Watchers

likeucode avatar Anmol Deep avatar  avatar  avatar  avatar paper2code - bot avatar

catn's Issues

Code cannot run

hi,I've been studing your code recently,but there is a problem when I try to run this code.When I ran dataset/preprocessing.py, code stop at split_train_test(); (this is the output of dataset/preprocessing.py
Load raw data from book2movie/reviews_Books_5.csv. Load raw data from book2movie/reviews_Movies_and_TV_5.csv. Source domain users 126666, items 63202, ratings 3494976. Target domain users 27822, items 12287, ratings 779376. Overlapping users 6074 (0.000%, 0.000%). Ratio 1.00, common users 3037, vali cold-start users 1214, test cold-start users 1823.)

so when I try to run runner/CATN_runner.py,there is a error just like this
Traceback (most recent call last): File "CATN_runner.py", line 106, in <module> with open(pkl_path % args.ratio, 'rb') as f: IOError: [Errno 2] No such file or directory: './dataset/book2movie/crossdata_i30_u10_0.20.pkl'

I wonder if u can help to figure this out ,thank u!!

preprocessing.py

As far as i'm concerned,it has a small bug.
In line 66,'index_t = df_t[["overall", "asin"]].groupby('asin').count() >= 30',I think you mean to write 'index_t = df_t[["overall", "asin"]].groupby('asin').count() >= thre_i'

Code cannot run

hi,I've been studing your code recently,but there is a problem when I try to run this code.when I try to run runner/CATN_runner.py,there is a error just like this

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "F:/Model-Code/CATN/runner/CATN_runner.py", line 162, in <module>
    catn_runner.step_train(sess)
  File "F:/Model-Code/CATN/runner/CATN_runner.py", line 90, in step_train
    self.catn.train_step(sess)
  File "F:\Model-Code\CATN\utils\CATN.py", line 372, in train_step
    self.ratings_ph: ratings_batch_s,
  File "E:\ruanjian\Miniconda3\envs\tensorflow110\lib\site-packages\tensorflow\python\client\session.py", line 877, in run
    run_metadata_ptr)
  File "E:\ruanjian\Miniconda3\envs\tensorflow110\lib\site-packages\tensorflow\python\client\session.py", line 1100, in _run
    feed_dict_tensor, options, run_metadata)
  File "E:\ruanjian\Miniconda3\envs\tensorflow110\lib\site-packages\tensorflow\python\client\session.py", line 1272, in _do_run
    run_metadata)
  File "E:\ruanjian\Miniconda3\envs\tensorflow110\lib\site-packages\tensorflow\python\client\session.py", line 1291, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: indices[57,12] = -1 is not in [0, 20001)
	 [[Node: embedding_lookup_2 = GatherV2[Taxis=DT_INT32, Tindices=DT_INT32, Tparams=DT_FLOAT, _class=["loc:@Adam/update_pre_word_embeddings/AssignSub"], _device="/job:localhost/replica:0/task:0/device:CPU:0"](pre_word_embeddings/read, embedding_lookup, embedding_lookup_5/axis)]]

Caused by op 'embedding_lookup_2', defined at:
  File "F:/Model-Code/CATN/runner/CATN_runner.py", line 162, in <module>
    catn_runner.step_train(sess)
  File "F:/Model-Code/CATN/runner/CATN_runner.py", line 89, in step_train
    self.catn = CATN(data, self.item_ave_rating_s, self.item_ave_rating_t, self.reviews, args, pkl_path)
  File "F:\Model-Code\CATN\utils\CATN.py", line 48, in __init__
    self.inference()
  File "F:\Model-Code\CATN\utils\CATN.py", line 103, in inference
    self.user_reviews_repr = tf.nn.embedding_lookup(self.word_embeddings, self.user_inputs)*self.user_inputs_mask
  File "E:\ruanjian\Miniconda3\envs\tensorflow110\lib\site-packages\tensorflow\python\ops\embedding_ops.py", line 310, in embedding_lookup
    transform_fn=None)
  File "E:\ruanjian\Miniconda3\envs\tensorflow110\lib\site-packages\tensorflow\python\ops\embedding_ops.py", line 133, in _embedding_lookup_and_transform
    result = _clip(array_ops.gather(params[0], ids, name=name),
  File "E:\ruanjian\Miniconda3\envs\tensorflow110\lib\site-packages\tensorflow\python\ops\array_ops.py", line 2659, in gather
    return gen_array_ops.gather_v2(params, indices, axis, name=name)
  File "E:\ruanjian\Miniconda3\envs\tensorflow110\lib\site-packages\tensorflow\python\ops\gen_array_ops.py", line 3761, in gather_v2
    "GatherV2", params=params, indices=indices, axis=axis, name=name)
  File "E:\ruanjian\Miniconda3\envs\tensorflow110\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper
    op_def=op_def)
  File "E:\ruanjian\Miniconda3\envs\tensorflow110\lib\site-packages\tensorflow\python\util\deprecation.py", line 454, in new_func
    return func(*args, **kwargs)
  File "E:\ruanjian\Miniconda3\envs\tensorflow110\lib\site-packages\tensorflow\python\framework\ops.py", line 3155, in create_op
    op_def=op_def)
  File "E:\ruanjian\Miniconda3\envs\tensorflow110\lib\site-packages\tensorflow\python\framework\ops.py", line 1717, in __init__
    self._traceback = tf_stack.extract_stack()

InvalidArgumentError (see above for traceback): indices[57,12] = -1 is not in [0, 20001)
	 [[Node: embedding_lookup_2 = GatherV2[Taxis=DT_INT32, Tindices=DT_INT32, Tparams=DT_FLOAT, _class=["loc:@Adam/update_pre_word_embeddings/AssignSub"], _device="/job:localhost/replica:0/task:0/device:CPU:0"](pre_word_embeddings/read, embedding_lookup, embedding_lookup_5/axis)]]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.