Examples of mutableCopy()


Examples of org.grouplens.lenskit.vectors.SparseVector.mutableCopy()

        if (history == null) {
            history = History.forUser(user);
        }
        SparseVector summary = summarizer.summarize(history);
        VectorTransformation transform = normalizer.makeTransformation(user, summary);
        MutableSparseVector normed = summary.mutableCopy();
        transform.apply(normed);

        scores.clear();
        algorithm.scoreItems(model, normed, scores, scorer);
View Full Code Here

Examples of org.grouplens.lenskit.vectors.SparseVector.mutableCopy()

        Cursor<UserHistory<Event>> users = userEventDAO.streamEventsByUser();
        try {
            for (UserHistory<Event> user : users) {
                long uid = user.getUserId();
                SparseVector summary = userSummarizer.summarize(user);
                MutableSparseVector normed = summary.mutableCopy();
                normalizer.normalize(uid, summary, normed);

                for (VectorEntry rating : normed) {
                    final long item = rating.getKey();
                    // get the item's rating accumulator
View Full Code Here

Examples of org.grouplens.lenskit.vectors.SparseVector.mutableCopy()

    public void testSelfSimilarity() {
        long keys[] = {1, 5, 7};
        double values[] = {1.5, 2.5, 2};
        SparseVector v = MutableSparseVector.wrap(keys, values).freeze();
        assertThat(sim.similarity(v, v), closeTo(1, EPSILON));
        assertThat(sim.similarity(v, v.mutableCopy().freeze()), closeTo(1, EPSILON));
    }

    @Test
    public void testDisjointSimilarity() {
        long keys[] = {1, 5, 7};
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.