コード例 #1
0
 @Override
 public int getInputDimensionality() {
   final LinearBinaryCategorizer firstPrototype =
       CollectionUtil.getFirst(this.prototypes.values());
   if (firstPrototype == null) {
     return -1;
   } else {
     return firstPrototype.getInputDimensionality();
   }
 }
コード例 #2
0
  /**
   * Evaluates how much the given input matches the prototype for the given category.
   *
   * @param input The input.
   * @param category The category to match the input against.
   * @return A real value indicating how much the input matches the category. A larger value
   *     indicates a better match.
   */
  public double evaluateAsDouble(final Vector input, final CategoryType category) {
    final LinearBinaryCategorizer prototype = this.prototypes.get(category);

    if (prototype == null) {
      // Bad prototype.
      return 0.0;
    } else {
      // Evaluate the input with the prototype.
      return prototype.evaluateAsDouble(input);
    }
  }