Skip to content

Commit

Permalink
Add ComparER models (PreferredAI#392)
Browse files Browse the repository at this point in the history
  • Loading branch information
lthoang committed Mar 9, 2021
1 parent 673402f commit d740f48
Show file tree
Hide file tree
Showing 10 changed files with 132,403 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ The recommender models supported by Cornac are listed below. Why don't you join
| Year | Model and paper | Additional dependencies | Examples |
| :---: | --- | :---: | :---: |
| 2021 | [Bilateral Variational Autoencoder for Collaborative Filtering (BiVAECF)](cornac/models/bivaecf), [paper](#) | [requirements.txt](cornac/models/bivaecf/requirements.txt) | [PreferredAI/bi-vae](https://github.com/PreferredAI/bi-vae)
| 2021 | [Explainable Recommendation with Comparative Constraints on Product Aspects](cornac/models/comparer), [paper](#) | N/A | [PreferredAI/ComparER](https://github.com/PreferredAI/ComparER)
| 2018 | [Collaborative Context Poisson Factorization (C2PF)](cornac/models/c2pf), [paper](https://www.ijcai.org/proceedings/2018/0370.pdf) | N/A | [c2pf_exp.py](examples/c2pf_example.py)
| | [Multi-Task Explainable Recommendation (MTER)](cornac/models/mter), [paper](https://arxiv.org/pdf/1806.03568.pdf) | N/A | [mter_exp.py](examples/mter_example.py)
| | [Neural Attention Rating Regression with Review-level Explanations (NARRE)](cornac/models/narre), [paper](http://www.thuir.cn/group/~YQLiu/publications/WWW2018_CC.pdf) | [requirements.txt](cornac/models/narre/requirements.txt) | [narre_example.py](examples/narre_example.py)
Expand Down
4 changes: 2 additions & 2 deletions cornac/datasets/amazon_toy.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from typing import List


def load_feedback(reader: Reader = None) -> List:
def load_feedback(fmt="UIR", reader: Reader = None) -> List:
"""Load the user-item ratings, scale: [1,5]
Parameters
Expand All @@ -38,7 +38,7 @@ def load_feedback(reader: Reader = None) -> List:
fpath = cache(url='https://static.preferred.ai/cornac/datasets/amazon_toy/rating.zip',
unzip=True, relative_path='amazon_toy/rating.txt')
reader = Reader() if reader is None else reader
return reader.read(fpath, fmt='UIR', sep=',')
return reader.read(fpath, fmt=fmt, sep=',')

def load_sentiment(reader: Reader = None) -> List:
"""Load the user-item-sentiments
Expand Down
2 changes: 2 additions & 0 deletions cornac/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
from .cdl import CDL
from .cdr import CDR
from .coe import COE
from .comparer import ComparERObj
from .comparer import ComparERSub
from .conv_mf import ConvMF
from .ctr import CTR
from .cvae import CVAE
Expand Down
17 changes: 17 additions & 0 deletions cornac/models/comparer/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2018 The Cornac Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================

from .recom_comparer_sub import ComparERSub
from .recom_comparer_obj import ComparERObj
Loading

0 comments on commit d740f48

Please sign in to comment.