Package org.grouplens.lenskit.data.history

Examples of org.grouplens.lenskit.data.history.RatingVectorUserHistorySummarizer


    private SlopeOneModel getModel(List<Rating> ratings) {
        EventDAO dao = EventCollectionDAO.create(ratings);
        UserEventDAO udao = new PrefetchingUserEventDAO(dao);
        ItemDAO idao = new PrefetchingItemDAO(dao);
        UserHistorySummarizer summarizer = new RatingVectorUserHistorySummarizer();
        ItemItemBuildContextProvider contextFactory = new ItemItemBuildContextProvider(
                udao, new DefaultUserVectorNormalizer(), summarizer);
        SlopeOneModelBuilder provider = new SlopeOneModelBuilder(idao, contextFactory.get(), 0);
        return provider.get();
    }
View Full Code Here


    private static final double EPSILON = 1.0e-6;

    private SlopeOneModel getModel(EventDAO dao) {
        UserEventDAO uedao = new PrefetchingUserEventDAO(dao);
        ItemDAO idao = new PrefetchingItemDAO(dao);
        UserHistorySummarizer summarizer = new RatingVectorUserHistorySummarizer();
        ItemItemBuildContextProvider contextFactory = new ItemItemBuildContextProvider(
                uedao, new DefaultUserVectorNormalizer(), summarizer);
        SlopeOneModelBuilder provider = new SlopeOneModelBuilder(idao, contextFactory.get(), 0);
        return provider.get();
    }
View Full Code Here

    @Test
    public void testUserMeanBaseline() {
        ItemScorer mean = makeGlobalMean();
        ItemScorer pred = new UserMeanItemScorer(new PrefetchingUserEventDAO(dao),
                                                 mean, new RatingVectorUserHistorySummarizer(),
                                                 0);
        // unseen item
        assertThat(pred.score(8, 4), closeTo(4.5, 0.001));
        // seen item - should be same avg
        assertThat(pred.score(8, 10), closeTo(4.5, 0.001));
View Full Code Here

     */
    @Test
    public void testUserMeanBaselineFallback() {
        ItemScorer mean = makeGlobalMean();
        ItemScorer pred = new UserMeanItemScorer(new PrefetchingUserEventDAO(dao),
                                                 mean, new RatingVectorUserHistorySummarizer(),
                                                 0);
        // unseen user - should be global mean
        assertThat(pred.score(10, 10), closeTo(RATINGS_DAT_MEAN, 0.001));
    }
View Full Code Here

    @Test
    public void testUserItemMeanBaseline() {
        ItemScorer base = new ItemMeanRatingItemScorer.Builder(dao, 0.0).get();
        ItemScorer pred = new UserMeanItemScorer(new PrefetchingUserEventDAO(dao),
                                                 base, new RatingVectorUserHistorySummarizer(),
                                                 0);
        // we use user 8 - their average offset is 0.5
        // unseen item, should be global mean + user offset
        assertThat(pred.score(8, 10),
                   closeTo(RATINGS_DAT_MEAN + 0.5, 0.001));
View Full Code Here

TOP

Related Classes of org.grouplens.lenskit.data.history.RatingVectorUserHistorySummarizer

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.