Package it.unimi.dsi.fastutil.longs

Examples of it.unimi.dsi.fastutil.longs.LongIterator.nextLong()


            LongIterator neighbors = iterationStrategy.neighborIterator(buildContext, rowItem, false);
            currentRow.fill(0);

            // Compute similarities and populate the vector
            while (neighbors.hasNext()) {
                final long colItem = neighbors.nextLong();
                final SparseVector vec2 = buildContext.itemVector(colItem);
                assert currentRow.containsKey(colItem);
                currentRow.set(colItem, similarity.similarity(rowItem, vec1, colItem, vec2));
            }
View Full Code Here


        SortComparator indexComparator = new SortComparator();

        LongIterator iter = keys.iterator();
        while (iter.hasNext()) {
            final long key = iter.nextLong();
            int[] indexes = map.get(key).toIntArray();
            if (needsSorting) {
                IntArrays.quickSort(indexes, indexComparator);
            }
View Full Code Here

        double gain = 0;
        int rank = 0;

        LongIterator iit = items.iterator();
        while (iit.hasNext()) {
            final long item = iit.nextLong();
            final double v = values.get(item);
            rank++;
            if (rank < 2) {
                gain += v;
            } else {
View Full Code Here

    double computeHLU(LongList items, SparseVector values) {
        double utility = 0;
        int rank = 0;
        LongIterator itemIterator = items.iterator();
        while (itemIterator.hasNext()) {
            final double v = values.get(itemIterator.nextLong());
            rank++;
            utility += v / Math.pow(2, (rank - 1) / (alpha - 1));
        }
        return utility;
    }
View Full Code Here

        double gain = 0;
        int rank = 0;

        LongIterator iit = items.iterator();
        while (iit.hasNext()) {
            final long item = iit.nextLong();
            final double v = values.get(item, 0);
            rank++;
            if (rank < 2) {
                gain += v;
            } else {
View Full Code Here

        LongSet items = dao.getItemIds();

        workMatrix = new Long2ObjectOpenHashMap<MutableSparseVector>(items.size());
        LongIterator iter = items.iterator();
        while (iter.hasNext()) {
            long item = iter.nextLong();
            workMatrix.put(item, MutableSparseVector.create(items));
            workMatrix.get(item).addChannelVector(SlopeOneModel.CORATINGS_SYMBOL);
        }
    }
View Full Code Here

    @Override
    public SlopeOneModel get() {
        LongSet items = buildContext.getItems();
        LongIterator outer = items.iterator();
        while (outer.hasNext()) {
            final long item1 = outer.nextLong();
            final SparseVector vec1 = buildContext.itemVector(item1);
            LongIterator inner = items.iterator();
            while (inner.hasNext()) {
                final long item2 = inner.nextLong();
                if (item1 != item2) {
View Full Code Here

        while (outer.hasNext()) {
            final long item1 = outer.nextLong();
            final SparseVector vec1 = buildContext.itemVector(item1);
            LongIterator inner = items.iterator();
            while (inner.hasNext()) {
                final long item2 = inner.nextLong();
                if (item1 != item2) {
                    SparseVector vec2 = buildContext.itemVector(item2);
                    accumulator.putItemPair(item1, vec1, item2, vec2);
                }
            }
View Full Code Here

            if (!user.containsKey(predicteeItem)) {
                double total = 0;
                int nitems = 0;
                LongIterator ratingIter = user.keySet().iterator();
                while (ratingIter.hasNext()) {
                    long currentItem = ratingIter.nextLong();
                    int nusers = model.getCoratings(predicteeItem, currentItem);
                    if (nusers != 0) {
                        double currentDev = model.getDeviation(predicteeItem, currentItem);
                        total += currentDev + user.get(currentItem);
                        nitems++;
View Full Code Here

            if (!ratings.containsKey(predicteeItem)) {
                double total = 0;
                int nusers = 0;
                LongIterator ratingIter = ratings.keySet().iterator();
                while (ratingIter.hasNext()) {
                    long currentItem = ratingIter.nextLong();
                    double currentDev = model.getDeviation(predicteeItem, currentItem);
                    if (!Double.isNaN(currentDev)) {
                        int weight = model.getCoratings(predicteeItem, currentItem);
                        total += (currentDev + ratings.get(currentItem)) * weight;
                        nusers += weight;
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.