Examples of domainSize()


Examples of org.grouplens.lenskit.collections.LongKeyDomain.domainSize()

        for (Long2ObjectMap.Entry<LongList> entry: userItems.long2ObjectEntrySet()) {
            userItemSets.put(entry.getLongKey(), LongUtils.packedSet(entry.getValue()));
        }

        LongKeyDomain items = LongKeyDomain.fromCollection(itemVectors.keySet(), true);
        SparseVector[] itemData = new SparseVector[items.domainSize()];
        for (int i = 0; i < itemData.length; i++) {
            long itemId = items.getKey(i);
            itemData[i] = itemVectors.get(itemId);
        }
View Full Code Here

Examples of org.grouplens.lenskit.collections.LongKeyDomain.domainSize()

        LongSortedSet itemUniverse = buildContext.getItems();

        final int nitems = itemUniverse.size();

        LongKeyDomain itemDomain = LongKeyDomain.fromCollection(itemUniverse, true);
        assert itemDomain.size() == itemDomain.domainSize();
        assert itemDomain.domainSize() == nitems;
        List<List<ScoredId>> matrix = Lists.newArrayListWithCapacity(itemDomain.domainSize());

        // working space for accumulating each row (reuse between rows)
        MutableSparseVector currentRow = MutableSparseVector.create(itemUniverse);
View Full Code Here

Examples of org.grouplens.lenskit.collections.LongKeyDomain.domainSize()

        final int nitems = itemUniverse.size();

        LongKeyDomain itemDomain = LongKeyDomain.fromCollection(itemUniverse, true);
        assert itemDomain.size() == itemDomain.domainSize();
        assert itemDomain.domainSize() == nitems;
        List<List<ScoredId>> matrix = Lists.newArrayListWithCapacity(itemDomain.domainSize());

        // working space for accumulating each row (reuse between rows)
        MutableSparseVector currentRow = MutableSparseVector.create(itemUniverse);
        Stopwatch timer = Stopwatch.createStarted();
View Full Code Here

Examples of org.grouplens.lenskit.collections.LongKeyDomain.domainSize()

        final int nitems = itemUniverse.size();

        LongKeyDomain itemDomain = LongKeyDomain.fromCollection(itemUniverse, true);
        assert itemDomain.size() == itemDomain.domainSize();
        assert itemDomain.domainSize() == nitems;
        List<List<ScoredId>> matrix = Lists.newArrayListWithCapacity(itemDomain.domainSize());

        // working space for accumulating each row (reuse between rows)
        MutableSparseVector currentRow = MutableSparseVector.create(itemUniverse);
        Stopwatch timer = Stopwatch.createStarted();
View Full Code Here

Examples of org.grouplens.lenskit.collections.LongKeyDomain.domainSize()

        Long2ObjectMap<ScoredIdListBuilder> itemRatingData = new Long2ObjectOpenHashMap<ScoredIdListBuilder>(1000);
        Long2ObjectMap<LongSortedSet> userItems = new Long2ObjectOpenHashMap<LongSortedSet>(1000);
        buildItemRatings(itemRatingData, userItems);

        LongKeyDomain items = LongKeyDomain.fromCollection(itemRatingData.keySet(), true);
        final int n = items.domainSize();
        assert n == itemRatingData.size();
        // finalize the item data into vectors
        SparseVector[] itemRatings = new SparseVector[n];

        for (int i = 0; i < n; i++) {
View Full Code Here

Examples of org.grouplens.lenskit.collections.LongKeyDomain.domainSize()

        double[] nvs;
        LongKeyDomain newDomain = keyDomain.clone();
        if (newDomain.isCompatibleWith(keys)) {
            nvs = (freeze && values.length == newDomain.size())
                    ? values
                    : java.util.Arrays.copyOf(values, newDomain.domainSize());
            newDomain.setActive(keys.getActiveMask());
        } else {
            nvs = new double[newDomain.domainSize()];

            int i = 0;
View Full Code Here

Examples of org.grouplens.lenskit.collections.LongKeyDomain.domainSize()

            nvs = (freeze && values.length == newDomain.size())
                    ? values
                    : java.util.Arrays.copyOf(values, newDomain.domainSize());
            newDomain.setActive(keys.getActiveMask());
        } else {
            nvs = new double[newDomain.domainSize()];

            int i = 0;
            int j = 0;
            final int end = keys.domainSize();
            while (i < nvs.length && j < end) {
View Full Code Here

Examples of org.grouplens.lenskit.collections.LongKeyDomain.domainSize()

        LongKeyDomain keys = LongKeyDomain.fromCollection(ids, false);
        MutableSparseVector msv = MutableSparseVector.create(keys.domain());
        long[] timestamps = null;
        // check for fast-path, where each item has one rating
        if (keys.domainSize() < ratings.size()) {
            timestamps = new long[keys.domainSize()];
        }

        for (Rating r: ratings) {
            long id = dimension.getId(r);
View Full Code Here

Examples of org.grouplens.lenskit.collections.LongKeyDomain.domainSize()

        LongKeyDomain keys = LongKeyDomain.fromCollection(ids, false);
        MutableSparseVector msv = MutableSparseVector.create(keys.domain());
        long[] timestamps = null;
        // check for fast-path, where each item has one rating
        if (keys.domainSize() < ratings.size()) {
            timestamps = new long[keys.domainSize()];
        }

        for (Rating r: ratings) {
            long id = dimension.getId(r);
            if (timestamps != null) {
View Full Code Here

Examples of org.grouplens.lenskit.collections.LongKeyDomain.domainSize()

                users.close();
            }

            Long2ObjectMap<LongList> itemUserLists = new Long2ObjectOpenHashMap<LongList>();
            LongKeyDomain domain = LongKeyDomain.fromCollection(vectors.keySet()).compactCopy(true);
            assert domain.size() == domain.domainSize();
            ImmutableList.Builder<ImmutableSparseVector> vecs = ImmutableList.builder();
            ImmutableList.Builder<ImmutableSparseVector> nvecs = ImmutableList.builder();
            for (LongIterator uiter = domain.activeSetView().iterator(); uiter.hasNext();) {
                final long user = uiter.nextLong();
                MutableSparseVector vec = vectors.get(user);
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.