@Test public void ratingVector() throws Exception { PreferenceArray prefs = dataModel.getPreferencesFromUser(1); Vector ratingVector = ALSWRFactorizer.ratingVector(prefs); assertEquals(prefs.length(), ratingVector.getNumNondefaultElements()); assertEquals(prefs.get(0).getValue(), ratingVector.get(0), EPSILON); assertEquals(prefs.get(1).getValue(), ratingVector.get(1), EPSILON); assertEquals(prefs.get(2).getValue(), ratingVector.get(2), EPSILON); }
protected static Vector ratingVector(PreferenceArray prefs) { double[] ratings = new double[prefs.length()]; for (int n = 0; n < prefs.length(); n++) { ratings[n] = prefs.get(n).getValue(); } return new DenseVector(ratings, true); }
ALSWRFactorizer extends AbstractFactorizer { protected static Vector ratingVector(PreferenceArray prefs) { double[] ratings = new double[prefs.length()]; for (int n = 0; n < prefs.length(); n++) { ratings[n] = prefs.get(n).getValue(); } return new DenseVector(ratings, true); } }
ALSWRFactorizer extends AbstractFactorizer { protected static Vector ratingVector(PreferenceArray prefs) { double[] ratings = new double[prefs.length()]; for (int n = 0; n < prefs.length(); n++) { ratings[n] = prefs.get(n).getValue(); } return new DenseVector(ratings, true); } ALSWRFactorizer(DataModel dataModel, int numFeatures, double lambda, int numIterations,
      boolean usesImplicitFeedback, double alpha, int numTrainingThreads);  ALSWRFactorizer(DataModel dataModel, int numFeatures, double lambda, int numIterations,
                         boolean usesImplicitFeedback, double alpha);  ALSWRFactorizer(DataModel dataModel, int numFeatures, double lambda, int numIterations); }
ALSWRFactorizer extends AbstractFactorizer { protected static Vector ratingVector(PreferenceArray prefs) { double[] ratings = new double[prefs.length()]; for (int n = 0; n < prefs.length(); n++) { ratings[n] = prefs.get(n).getValue(); } return new DenseVector(ratings, true); } ALSWRFactorizer(DataModel dataModel, int numFeatures, double lambda, int numIterations,
      boolean usesImplicitFeedback, double alpha, int numTrainingThreads);  ALSWRFactorizer(DataModel dataModel, int numFeatures, double lambda, int numIterations,
                         boolean usesImplicitFeedback, double alpha);  ALSWRFactorizer(DataModel dataModel, int numFeatures, double lambda, int numIterations); @Override Factorization factorize(); }
ALSWRFactorizer extends AbstractFactorizer { protected static Vector ratingVector(PreferenceArray prefs) { double[] ratings = new double[prefs.length()]; for (int n = 0; n < prefs.length(); n++) { ratings[n] = prefs.get(n).getValue(); } return new DenseVector(ratings, true); } ALSWRFactorizer(DataModel dataModel, int numFeatures, double lambda, int numIterations,
      boolean usesImplicitFeedback, double alpha, int numTrainingThreads);  ALSWRFactorizer(DataModel dataModel, int numFeatures, double lambda, int numIterations,
                         boolean usesImplicitFeedback, double alpha);  ALSWRFactorizer(DataModel dataModel, int numFeatures, double lambda, int numIterations); @Override Factorization factorize();  }