public void setFeatureColumn()
        {
            ALSWRFactorizer.Features features = new ALSWRFactorizer.Features(factorizer);
            var vector = new double[] { 0.5, 2.0, 1.5 };
            int index  = 1;

            features.setFeatureColumnInM(index, vector);
            double[][] matrix = features.getM();

            Assert.AreEqual(vector[0], matrix[index][0], EPSILON);
            Assert.AreEqual(vector[1], matrix[index][1], EPSILON);
            Assert.AreEqual(vector[2], matrix[index][2], EPSILON);
        }
예제 #2
0
        public void initializeM()
        {
            ALSWRFactorizer.Features features = new ALSWRFactorizer.Features(factorizer);
            double[][] M = features.getM();

            Assert.AreEqual(3.333333333, M[0][0], EPSILON);
            Assert.AreEqual(5, M[1][0], EPSILON);
            Assert.AreEqual(2.5, M[2][0], EPSILON);
            Assert.AreEqual(4.333333333, M[3][0], EPSILON);

            for (int itemIndex = 0; itemIndex < dataModel.GetNumItems(); itemIndex++) {
              for (int feature = 1; feature < 3; feature++ ) {
            Assert.True(M[itemIndex][feature] >= 0);
            Assert.True(M[itemIndex][feature] <= 0.1);
              }
            }
        }
        public void initializeM()
        {
            ALSWRFactorizer.Features features = new ALSWRFactorizer.Features(factorizer);
            double[][] M = features.getM();

            Assert.AreEqual(3.333333333, M[0][0], EPSILON);
            Assert.AreEqual(5, M[1][0], EPSILON);
            Assert.AreEqual(2.5, M[2][0], EPSILON);
            Assert.AreEqual(4.333333333, M[3][0], EPSILON);

            for (int itemIndex = 0; itemIndex < dataModel.GetNumItems(); itemIndex++)
            {
                for (int feature = 1; feature < 3; feature++)
                {
                    Assert.True(M[itemIndex][feature] >= 0);
                    Assert.True(M[itemIndex][feature] <= 0.1);
                }
            }
        }
예제 #4
0
        public void setFeatureColumn()
        {
            ALSWRFactorizer.Features features = new ALSWRFactorizer.Features(factorizer);
            var vector = new double[] { 0.5, 2.0, 1.5 };
            int index = 1;

            features.setFeatureColumnInM(index, vector);
            double[][] matrix = features.getM();

            Assert.AreEqual(vector[0], matrix[index][0], EPSILON);
            Assert.AreEqual(vector[1], matrix[index][1], EPSILON);
            Assert.AreEqual(vector[2], matrix[index][2], EPSILON);
        }
예제 #5
0
 public void averageRating()
 {
     ALSWRFactorizer.Features features = new ALSWRFactorizer.Features(factorizer);
     Assert.AreEqual(2.5, features.averateRating(3L), EPSILON);
 }
 public void averageRating()
 {
     ALSWRFactorizer.Features features = new ALSWRFactorizer.Features(factorizer);
     Assert.AreEqual(2.5, features.averateRating(3L), EPSILON);
 }