コード例 #1
0
 @Override
 public DoubleArray estimate(DataFrame x, Vector y) {
   Objects.requireNonNull(x, "Input data required.");
   Objects.requireNonNull(y, "Input target required.");
   Check.argument(x.rows() == y.size(), "The size of input data and input target don't match.");
   return errorFunction.apply(classifier.estimate(x), y, classifier.getClasses());
 }
コード例 #2
0
 @Override
 public double estimate(Vector example, Object label) {
   Objects.requireNonNull(example, "Require an example.");
   int trueClassIndex = classifier.getClasses().loc().indexOf(label);
   Check.argument(trueClassIndex >= 0, "illegal label %s", label);
   return errorFunction.apply(classifier.estimate(example), trueClassIndex);
 }
コード例 #3
0
 @Override
 public Nonconformity fit(DataFrame x, Vector y) {
   Objects.requireNonNull(x, "Input data is required.");
   Objects.requireNonNull(y, "Input target is required.");
   Check.argument(x.rows() == y.size(), "The size of input data and input target don't match");
   Classifier probabilityEstimator = classifier.fit(x, y);
   Check.state(
       probabilityEstimator != null
           && probabilityEstimator
               .getCharacteristics()
               .contains(ClassifierCharacteristic.ESTIMATOR),
       "The produced classifier can't estimate probabilities");
   return new ProbabilityEstimateNonconformity(probabilityEstimator, errorFunction);
 }