test_class.declarator: recommender
test_class.modifier: private final
test_class.original_string: private final MFRecommender<String, String> recommender;
test_class.type: MFRecommender<String, String>
test_class.var_name: recommender
test_class.file: RankSys-mf/src/test/java/es/uam/eps/ir/ranksys/mf/rec/MFRecommenderTest.java
test_class.identifier: MFRecommenderTest
test_case.body: @Test
      public void testFilter() {
          int maxLength = 2;
          IntPredicate filter = i -> i % 2 == 0;
  
          List<Tuple2id> result = recommender.getRecommendation(0, maxLength, filter).getIidxs();
  
          List<Tuple2id> expected = Arrays.asList(
                  tuple(0, 6.1),
                  tuple(2, 4.1)
          );
          
          assertEquals(expected, result);
      }
test_case.class_method_signature: MFRecommenderTest.testFilter()
test_case.full_signature: @Test public void testFilter()
test_case.identifier: testFilter
test_case.invocations: getIidxs getRecommendation asList tuple tuple assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testFilter()
focal_class.declarator: factorization
focal_class.modifier: private final
focal_class.original_string: private final Factorization<U, I> factorization;
focal_class.type: Factorization<U, I>
focal_class.var_name: factorization
focal_class.file: RankSys-mf/src/main/java/es/uam/eps/ir/ranksys/mf/rec/MFRecommender.java
focal_class.identifier: MFRecommender
focal_class.class_method_signature: MFRecommender.MFRecommender(FastUserIndex<U> uIndex, FastItemIndex<I> iIndex, Factorization<U, I> factorization)
focal_class.full_signature: public  MFRecommender(FastUserIndex<U> uIndex, FastItemIndex<I> iIndex, Factorization<U, I> factorization)
focal_class.identifier: MFRecommender
focal_class.modifiers: public
focal_class.parameters: (FastUserIndex<U> uIndex, FastItemIndex<I> iIndex, Factorization<U, I> factorization)
focal_class.signature:  MFRecommender(FastUserIndex<U> uIndex, FastItemIndex<I> iIndex, Factorization<U, I> factorization)
focal_class.class_method_signature: MFRecommender.getRecommendation(int uidx, int maxLength, IntPredicate filter)
focal_class.full_signature: @Override public FastRecommendation getRecommendation(int uidx, int maxLength, IntPredicate filter)
focal_class.identifier: getRecommendation
focal_class.modifiers: @Override public
focal_class.parameters: (int uidx, int maxLength, IntPredicate filter)
focal_class.return: FastRecommendation
focal_class.signature: FastRecommendation getRecommendation(int uidx, int maxLength, IntPredicate filter)
focal_class.class_method_signature: MFRecommender.getRecommendation(int uidx, IntStream candidates)
focal_class.full_signature: @Override public FastRecommendation getRecommendation(int uidx, IntStream candidates)
focal_class.identifier: getRecommendation
focal_class.modifiers: @Override public
focal_class.parameters: (int uidx, IntStream candidates)
focal_class.return: FastRecommendation
focal_class.signature: FastRecommendation getRecommendation(int uidx, IntStream candidates)
focal_class.superclass: extends AbstractFastRecommender<U, I>
focal_method.body: @Override
      public FastRecommendation getRecommendation(int uidx, int maxLength, IntPredicate filter) {
          DoubleMatrix1D pu;
  
          pu = factorization.getUserVector(uidx2user(uidx));
          if (pu == null) {
              return new FastRecommendation(uidx, new ArrayList<>());
          }
  
          IntDoubleTopN topN = new IntDoubleTopN(min(maxLength, factorization.numItems()));
  
          DoubleMatrix1D r = factorization.getItemMatrix().zMult(pu, null);
          for (int iidx = 0; iidx < r.size(); iidx++) {
              if (filter.test(iidx)) {
                  topN.add(iidx, r.getQuick(iidx));
              }
          }
  
          topN.sort();
  
          List<Tuple2id> items = topN.reverseStream()
                  .collect(toList());
  
          return new FastRecommendation(uidx, items);
      }
focal_method.class_method_signature: MFRecommender.getRecommendation(int uidx, int maxLength, IntPredicate filter)
focal_method.full_signature: @Override public FastRecommendation getRecommendation(int uidx, int maxLength, IntPredicate filter)
focal_method.identifier: getRecommendation
focal_method.invocations: getUserVector uidx2user min numItems zMult getItemMatrix size test add getQuick sort collect reverseStream toList
focal_method.modifiers: @Override public
focal_method.parameters: (int uidx, int maxLength, IntPredicate filter)
focal_method.return: FastRecommendation
focal_method.signature: FastRecommendation getRecommendation(int uidx, int maxLength, IntPredicate filter)