Package org.grouplens.lenskit

Examples of org.grouplens.lenskit.RatingPredictor.predict()


    @Override
    public SparseVector getPredictions() {
        if (predictionCache == null) {
            RatingPredictor pred = recommender.getRatingPredictor();
            if (pred != null) {
                predictionCache = pred.predict(getUserId(), getTestRatings().keySet());
            }
        }
        return predictionCache;
    }
View Full Code Here


                                         .addScore(42, 3, 3.0)
                                         .build();
        ItemScorer scorer = new FallbackItemScorer(primary, base1);
        RatingPredictor pred = new SimpleRatingPredictor(scorer, base2, null);
        MutableSparseVector vec = MutableSparseVector.create(1, 2, 3);
        pred.predict(42, vec);
        assertThat(vec.size(), equalTo(3));
        assertThat(vec.get(1), equalTo(3.5));
        assertThat(vec.get(2), equalTo(2.5));
        assertThat(vec.get(3), equalTo(3.0));
        assertThat(vec.getChannel(FallbackItemScorer.SCORE_SOURCE_SYMBOL).get(1),
View Full Code Here

        }

        logger.info("predicting {} items", items.size());
        Symbol pchan = getPrintChannel();
        Stopwatch timer = Stopwatch.createStarted();
        SparseVector preds = pred.predict(user, items);
        Long2ObjectMap channel = null;
        if (pchan != null) {
            for (TypedSymbol sym: preds.getChannelSymbols()) {
                if (sym.getRawSymbol().equals(pchan)) {
                    channel = preds.getChannel(sym);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.