Attribute ti=tir.getAttribute();
ItemRecommender model = exampleSetInput2.getData();
IPosOnlyFeedback train_data=new PosOnlyFeedback();
IPosOnlyFeedback test_data=new PosOnlyFeedback();
IEntityMapping user_mapping=model.user_mapping;//new EntityMapping();
IEntityMapping item_mapping=model.item_mapping;//new EntityMapping();
for (Example example : exampleSet) {
double j=example.getValue(u);
int uid=(int) j;
j=example.getValue(i);
int iid=(int) j;
train_data.Add(user_mapping.ToInternalID(uid), item_mapping.ToInternalID(iid));
}
for (Example example : exampleSet1) {
double j=example.getValue(tu);
int uid=(int) j;
j=example.getValue(ti);
int iid=(int) j;
test_data.Add(user_mapping.ToInternalID(uid), item_mapping.ToInternalID(iid));
}
Map<String,Double> result= ItemPredictionEval.Evaluate(model, test_data,train_data,test_data.GetAllUsers(),train_data.GetAllItems()); //train_data.GetAllUsers(),train_data.GetAllItems()
Attribute m1 = AttributeFactory.createAttribute("AUC", Ontology.REAL);
Attribute m2 = AttributeFactory.createAttribute("prec@5", Ontology.REAL);
Attribute m3 = AttributeFactory.createAttribute("prec@10", Ontology.REAL);
Attribute m4 = AttributeFactory.createAttribute("prec@15", Ontology.REAL);