Пример #1
0
    /**
     * The constructor of OrdRecParameter. It use the quantized values of rating to initialize t1
     * and beta. Each threshold is initialized as the mean of two contiguous rating values. Since
     * the index of quantizer is always an successive non-negative integer begin from 0, so t1 will
     * initialize as 0.5, and the interval between two thresholds will be 1.
     *
     * @param qtz The quantizer for ratings
     */
    private OrdRecModel(Quantizer qtz) {
      qtzValues = qtz.getValues();
      levelCount = qtzValues.length();
      t1 = (qtzValues.get(0) + qtzValues.get(1)) / 2;
      beta = Vector.createLength(levelCount - 2);

      double tr = t1;
      for (int i = 1; i <= beta.length(); i++) {
        double trnext = (qtzValues.get(i) + qtzValues.get(i + 1)) * 0.5;
        beta.set(i - 1, Math.log(trnext - tr));
        tr = trnext;
      }
    }
Пример #2
0
 @Override
 public void set(int row, int column, double value) {
   if (row != 0) throw new IndexOutOfBoundsException("Row: " + row);
   vector.set(column, value);
 }