Package org.grouplens.lenskit.symbols

Examples of org.grouplens.lenskit.symbols.Symbol


        }
    }

    @Test
    public void testIgnoreInvalidChannel() {
        Symbol sym = Symbol.of("symbol");
        ScoredId id = new ScoredIdBuilder(72, 8.5).addChannel(sym, 3.5).build();
        PackedScoredIdList list = builder.ignoreUnknownChannels()
                                         .add(id)
                                         .build();
        assertThat(FluentIterable.from(list).first().get().hasUnboxedChannel(sym),
View Full Code Here


        assertThat(sid.getChannelValue(sym), nullValue());
    }

    @Test
    public void testIncludesUnboxedChannels() {
        Symbol sym = Symbol.of("foo");
        TypedSymbol<Double> tsym = sym.withType(Double.class);
        PackedScoredIdList list = builder.addChannel(sym)
                                         .add(42, 3.9)
                                         .build();
        ScoredId sid = list.get(0);
        assertThat(sid.hasUnboxedChannel(sym), equalTo(true));
View Full Code Here

        assertThat(comp.compare(high, low), greaterThan(0));
    }

    @Test
    public void testChannelComparator() {
        Symbol foo = Symbol.of("foo");
        ScoredId low = new ScoredIdBuilder(1, 5).addChannel(foo, 2.5).build();
        ScoredId high = new ScoredIdBuilder(2, 5).addChannel(foo, 3.5).build();
        ScoredId missing = new ScoredIdBuilder(3, 5).build();
        Ordering<ScoredId> comp = ScoredIds.channelOrder(foo);
        assertThat(comp.compare(low, low), equalTo(0));
View Full Code Here

            logger.error("recommender has no item recommender");
            throw new UnsupportedOperationException("no item recommender");
        }

        logger.info("recommending for {} users", users.size());
        Symbol pchan = getPrintChannel();
        Stopwatch timer = Stopwatch.createStarted();
        for (long user: users) {
            List<ScoredId> recs = irec.recommend(user, n);
            System.out.format("recommendations for user %d:\n", user);
            for (ScoredId item: recs) {
View Full Code Here

            logger.error("recommender has no rating predictor");
            throw new UnsupportedOperationException("no rating predictor");
        }

        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()) {
View Full Code Here

TOP

Related Classes of org.grouplens.lenskit.symbols.Symbol

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.