org.mymedialite.eval
Class Items

java.lang.Object
  extended by org.mymedialite.eval.Items

public class Items
extends java.lang.Object

Evaluation class for item recommendation.


Method Summary
static void displayResults(java.util.HashMap<java.lang.String,java.lang.Double> result)
          Display item prediction results.
static ItemRecommendationEvaluationResults evaluate(IRecommender recommender, IPosOnlyFeedback test, IPosOnlyFeedback train, java.util.Collection<java.lang.Integer> test_users, java.util.Collection<java.lang.Integer> candidate_items)
          Evaluation for rankings of item recommenders.
static ItemRecommendationEvaluationResults evaluate(IRecommender recommender, IPosOnlyFeedback test, IPosOnlyFeedback training, java.util.Collection<java.lang.Integer> test_users, java.util.Collection<java.lang.Integer> candidate_items, CandidateItems candidate_item_mode, java.lang.Boolean repeated_events)
          Evaluation for rankings of items.
static java.lang.String formatResults(java.util.Map<java.lang.String,java.lang.Double> result)
          Format item prediction results.
static java.util.Collection<java.lang.String> getMeasures()
          Get the evaluation measures for item prediction offered by the class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getMeasures

public static java.util.Collection<java.lang.String> getMeasures()
Get the evaluation measures for item prediction offered by the class.


evaluate

public static ItemRecommendationEvaluationResults evaluate(IRecommender recommender,
                                                           IPosOnlyFeedback test,
                                                           IPosOnlyFeedback train,
                                                           java.util.Collection<java.lang.Integer> test_users,
                                                           java.util.Collection<java.lang.Integer> candidate_items)
Evaluation for rankings of item recommenders. User-item combinations that appear in both sets are ignored for the test set, and thus in the evaluation. The evaluation measures are listed in the ItemPredictionMeasures property. Additionally, 'num_users' and 'num_items' report the number of users that were used to compute the results and the number of items that were taken into account. Literature: C. Manning, P. Raghavan, H. Schütze: Introduction to Information Retrieval, Cambridge University Press, 2008

Parameters:
recommender - item recommender
test - test cases
train - training data
test_users - a collection of integers with all relevant_users
candidate_items - a collection of integers with all candidate items
Returns:
a dictionary containing the evaluation results

evaluate

public static ItemRecommendationEvaluationResults evaluate(IRecommender recommender,
                                                           IPosOnlyFeedback test,
                                                           IPosOnlyFeedback training,
                                                           java.util.Collection<java.lang.Integer> test_users,
                                                           java.util.Collection<java.lang.Integer> candidate_items,
                                                           CandidateItems candidate_item_mode,
                                                           java.lang.Boolean repeated_events)
Evaluation for rankings of items. User-item combinations that appear in both sets are ignored for the test set, and thus in the evaluation, except when the boolean argument repeated_events is set. The evaluation measures are listed in the ItemPredictionMeasures property. Additionally, 'num_users' and 'num_items' report the number of users that were used to compute the results and the number of items that were taken into account. Literature: C. Manning, P. Raghavan, H. Schütze: Introduction to Information Retrieval, Cambridge University Press, 2008

Parameters:
recommender - item recommender
test - test cases
training - training data
test_users - a collection of integers with all relevant users
candidate_items - a collection of integers with all relevant items
candidate_item_mode - the mode used to determine the candidate items. The default is CandidateItems.OVERLAP
repeated_events - allow repeated events in the evaluation (i.e. items accessed by a user before may be in the recommended list). The default is false.
Returns:
a dictionary containing the evaluation results

formatResults

public static java.lang.String formatResults(java.util.Map<java.lang.String,java.lang.Double> result)
Format item prediction results.

Parameters:
result - the result dictionary
Returns:
a string containing the results

displayResults

public static void displayResults(java.util.HashMap<java.lang.String,java.lang.Double> result)
Display item prediction results.

Parameters:
result - the result dictionary