Examples of MutableSparseVector


Examples of org.grouplens.lenskit.vectors.MutableSparseVector

        List<Rating> ratings = new ArrayList<Rating>();
        ratings.add(new SimpleRating(1, 2, 3.0, 3));
        ratings.add(new SimpleRating(1, 5, 2.3, 4));
        ratings.add(new SimpleRating(1, 3, 4.5, 5));
        ratings.add(new SimpleRating(1, 5, 3.7, 6));
        MutableSparseVector urv = Ratings.userRatingVector(ratings);
        assertThat(urv.isEmpty(), equalTo(false));
        assertThat(urv.size(), equalTo(3));
        assertThat(urv.get(2), closeTo(3.0, 1.0e-6));
        assertThat(urv.get(3), closeTo(4.5, 1.0e-6));
        assertThat(urv.get(5), closeTo(3.7, 1.0e-6));
        assertThat(urv.containsKey(1), equalTo(false));
    }
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.