Skip to content

Commit

Permalink
Added legacy lightgcn for comparison purposes
Browse files Browse the repository at this point in the history
  • Loading branch information
darrylong committed Oct 13, 2023
1 parent 1ae4584 commit ea88208
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
3 changes: 2 additions & 1 deletion cornac/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
from .ibpr import IBPR
from .knn import ItemKNN
from .knn import UserKNN
from .lightgcn import LightGCN
from .lightgcn import LightGCN1
from .lightgcn2 import LightGCN
from .mcf import MCF
from .mf import MF
from .mmmf import MMMF
Expand Down
2 changes: 1 addition & 1 deletion cornac/models/lightgcn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# limitations under the License.
# ============================================================================

from .recom_lightgcn import LightGCN
from .recom_lightgcn import LightGCN1
2 changes: 1 addition & 1 deletion cornac/models/lightgcn/recom_lightgcn.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from tqdm.auto import tqdm, trange


class LightGCN(Recommender):
class LightGCN1(Recommender):
"""
LightGCN
Expand Down
14 changes: 13 additions & 1 deletion examples/lightgcn_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@
rating_threshold=0.5,
)

lightgcn1 = cornac.models.LightGCN1(
name="LightGCN-old",
seed=123,
num_epochs=2000,
num_layers=3,
early_stopping={"min_delta": 1e-4, "patience": 3},
train_batch_size=256,
learning_rate=0.001,
lambda_reg=1e-4,
verbose=True
)

# Instantiate the LightGCN model
lightgcn = cornac.models.LightGCN(
seed=123,
Expand All @@ -52,7 +64,7 @@
# Put everything together into an experiment and run it
cornac.Experiment(
eval_method=ratio_split,
models=[lightgcn],
models=[lightgcn1, lightgcn],
metrics=[rec_20, ndcg_20],
user_based=True,
).run()

0 comments on commit ea88208

Please sign in to comment.