Skip to content

Commit

Permalink
change in exp
Browse files Browse the repository at this point in the history
  • Loading branch information
saghiles committed Mar 21, 2019
1 parent 90cb8cf commit 0e534ae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions cornac/experiment/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ def run(self):
organized_metrics = {'ranking': [], 'rating': []}

# Organize metrics into "rating" and "ranking" for efficiency purposes
#for mt in self.metrics:
# organized_metrics[mt.type].append(mt)
# metric_names.append(mt.name)
for mt in self.metrics:
organized_metrics[mt.type].append(mt)
metric_names.append(mt.name)

for model in self.models:
if self.verbose:
Expand Down
10 changes: 5 additions & 5 deletions examples/c2pf_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@
from cornac.experiment import Experiment
from cornac import metrics
from cornac.models import C2PF
import numpy as np
from cornac.datasets import amazon_office as office

# Load office ratings and item contexts, see C2PF paper for details
ratings = office.load_rating()
contexts = office.load_context()

item_graph_module = GraphModule(data=office_context)
item_graph_module = GraphModule(data=contexts)

ratio_split = RatioSplit(data=office_ratings,
ratio_split = RatioSplit(data=ratings,
test_size=0.2, rating_threshold=3.5,
shuffle=True, exclude_unknowns=True,
verbose=True, item_graph=item_graph_module)

rec_c2pf = C2PF(k=100, max_iter=80, variant='c2pf')
c2pf = C2PF(k=100, max_iter=1, variant='c2pf')

# Evaluation metrics
nDgc = metrics.NDCG(k=-1)
Expand All @@ -33,6 +33,6 @@

# Instantiate and run your experiment
exp = Experiment(eval_method=ratio_split,
models=[rec_c2pf],
models=[c2pf],
metrics=[nDgc, mrr, rec, pre])
exp.run()

0 comments on commit 0e534ae

Please sign in to comment.