Package it.unimi.dsi.fastutil.longs

Examples of it.unimi.dsi.fastutil.longs.LongSet


        TestUser user = MockTestUser.newBuilder()
                                    .setUserId(42)
                                    .addTrainRating(88, 3.5)
                                    .setRecommender(recommender)
                                    .build();
        LongSet items = ItemSelectors.trainingItems().select(user);
        assertThat(items, containsInAnyOrder(88L));
    }
View Full Code Here


                                    .addTestRating(88, 3.5)
                                    .addTestRating(5, 2.4)
                                    .addTestRating(6, 4.0)
                                    .setRecommender(recommender)
                                    .build();
        LongSet items = ItemSelectors.testRatingMatches(greaterThanOrEqualTo(3.5))
                                     .select(user);
        assertThat(items, containsInAnyOrder(88L, 6L));
    }
View Full Code Here

        TestUser user = MockTestUser.newBuilder()
                                    .setUserId(42)
                                    .addTestRating(88, 3.5)
                                    .setRecommender(recommender)
                                    .build();
        LongSet items = ItemSelectors.addNRandom(ItemSelectors.testItems(), 1)
                                     .select(user);
        assertThat(items, hasSize(2));
        assertThat(items, hasItem(88L));
        assertThat(items, anyOf(hasItem(42L),
                                hasItem(39L),
View Full Code Here

        TestUser user = MockTestUser.newBuilder()
                                    .setUserId(42)
                                    .addTestRating(67, 3.5)
                                    .setRecommender(recommender)
                                    .build();
        LongSet items = ItemSelectors.allItemsExcept(ItemSelectors.testItems())
                                     .select(user);
        assertThat(items, containsInAnyOrder(42L, 39L));
    }
View Full Code Here

                                    .addTrainRating(2, 2)
                                    .addTestRating(2, 2)
                                    .addTestRating(3, 3)
                                    .setRecommender(recommender)
                                    .build();
        LongSet items = ItemSelectors.union(ItemSelectors.testItems(),
                                            ItemSelectors.trainingItems())
                                     .select(user);
        assertThat(items, containsInAnyOrder(1L, 2L, 3L));
        assertThat(items, hasSize(3));
    }
View Full Code Here

                                    .addTrainRating(2, 2)
                                    .addTestRating(2, 2)
                                    .addTestRating(3, 3)
                                    .setRecommender(recommender)
                                    .build();
        LongSet items = ItemSelectors.setDifference(ItemSelectors.testItems(),
                                                    ItemSelectors.trainingItems())
                                     .select(user);
        assertThat(items, containsInAnyOrder(3L));
        assertThat(items, hasSize(1));
    }   
View Full Code Here

                                    .addTrainRating(88, 3.5)
                                    .addTrainRating(5, 2.4)
                                    .addTrainRating(6, 4.0)
                                    .setRecommender(recommender)
                                    .build();
        LongSet items = ItemSelectors.randomSubset(ItemSelectors.trainingItems(), 2)
                                     .select(user);

        assertThat(items, hasSize(2));
        assertThat(items, not(hasItem(7L)));
        assertThat(LongUtils.setDifference(LongUtils.packedSet(88, 5, 6), items), hasSize(1));
View Full Code Here

     * @param items   The target items.
     * @return Baseline predictions for all items either in the target set or the set of
     *         rated items.
     */
    private MutableSparseVector initialEstimates(long user, SparseVector ratings, LongSortedSet items) {
        LongSet allItems = LongUtils.setUnion(items, ratings.keySet());
        MutableSparseVector estimates = MutableSparseVector.create(allItems);
        baselineScorer.score(user, estimates);
        return estimates;
    }
View Full Code Here

  }

  @Override
  public RandomAccessFilter buildRandomAccessAndFilter(String[] vals,
      Properties prop) throws IOException {
    LongSet longSet = new LongOpenHashSet();
    for (String val : vals){
      try{
        longSet.add(Long.parseLong(val));
      }
      catch(Exception e){
        throw new IOException(e.getMessage());
      }
    }
    if (longSet.size()!=1){
      return EmptyFilter.getInstance();
    }
    else{
      return buildRandomAccessFilter(longSet.iterator().nextLong());
    }
  }
View Full Code Here

  }

  @Override
  public RandomAccessFilter buildRandomAccessOrFilter(String[] vals,
      Properties prop, boolean isNot) throws IOException {
    LongSet longSet = new LongOpenHashSet();
    for (String val : vals){
      try{
        longSet.add(Long.parseLong(val));
      }
      catch(Exception e){
        throw new IOException(e.getMessage());
      }
    }
    RandomAccessFilter filter;
    if (longSet.size()==1){
      filter = buildRandomAccessFilter(longSet.iterator().nextLong());
    }
    else{
      filter =  buildRandomAccessFilter(longSet);
    }
    if (filter == null) return filter;
View Full Code Here

TOP

Related Classes of it.unimi.dsi.fastutil.longs.LongSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.