@Override public void doWork() throws OperatorException { ExampleSet exampleSet = exampleSetInput.getData(); IPosOnlyFeedback training_data = new PosOnlyFeedback(); IEntityMapping user_mapping = new EntityMapping(); IEntityMapping item_mapping = new EntityMapping(); if (exampleSet.getAttributes().getSpecial("user identification") == null) { throw new UserError(this, 105); } if (exampleSet.getAttributes().getSpecial("item identification") == null) { throw new UserError(this, 105); } Attributes Att = exampleSet.getAttributes(); AttributeRole ur = Att.getRole("user identification"); Attribute u = ur.getAttribute(); AttributeRole ir = Att.getRole("item identification"); Attribute i = ir.getAttribute(); for (Example example : exampleSet) { double j = example.getValue(u); int uid = (int) j; j = example.getValue(i); int iid = (int) j; training_data.Add(user_mapping.ToInternalID(uid), item_mapping.ToInternalID(iid)); checkForStop(); } System.out.println(training_data.GetMaxItemID() + " " + training_data.GetMaxUserID()); Random recommendAlg = new Random(); recommendAlg.SetFeedback(training_data); recommendAlg.user_mapping = user_mapping; recommendAlg.item_mapping = item_mapping; recommendAlg.Train(); exampleSetOutput.deliver(exampleSet); exampleSetOutput1.deliver(recommendAlg); }