Package com.tibco.patterns.learn.training

## Class COErrorRate.IterationResult

- java.lang.Object
- - com.tibco.patterns.learn.training.COErrorRate.IterationResult

- All Implemented Interfaces:
    `java.lang.Cloneable`
  Enclosing class:
    COErrorRate

      public static final class COErrorRate.IterationResult
      extends java.lang.Object
      implements java.lang.Cloneable

  Stores statistics for a full or partial training iteration

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `IterationResult​(double threshold)` | Initializes all values to 0.
    `IterationResult​(int nFalseExamples, int nTrueExamples, int nErrors, int nFalsePos, int nFalseNeg, int nUntrainedPred, double totalConf)` | Stores all given values in the new object.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addPrediction​(RLinkOut prediction, boolean label)` | Updates all stored statistics based on the additional model prediction.
    `COErrorRate.IterationResult` | `clone()` | Performs shallow copy of all simple types.
    `double` | `errorRate()` |
    `double` | `falseNegRate()` |
    `double` | `falsePosRate()` |
    `int` | `getNErrors()` |
    `int` | `getNExamples()` |
    `int` | `getNFalseExamples()` |
    `int` | `getNFalseNeg()` |
    `int` | `getNFalsePos()` |
    `int` | `getNTrueExamples()` |
    `int` | `getNUntrainedPred()` | Returns the number of examples that cannot be reliably predicted.
    `double` | `getTotalConf()` |
    `boolean` | `isConverged()` | Returns true if the default target error rate has been reached.
    `boolean` | `isConverged​(double targetErrorRate)` | Returns true if the target error rate has been reached.
    `boolean` | `isPerfectResult()` |
    `double` | `meanConf()` |
    `double` | `meanDist()` |
    `double` | `meanErrConf()` |
    `double` | `meanErrDist()` |
    `double` | `noPredictionRate()` | Returns the percentage of examples that cannot be reliably predicted.

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### IterationResult

          public IterationResult​(int nFalseExamples,
                                 int nTrueExamples,
                                 int nErrors,
                                 int nFalsePos,
                                 int nFalseNeg,
                                 int nUntrainedPred,
                                 double totalConf)

      Stores all given values in the new object. Total confidence for errors and both total distance values are initialized to 0. Used only to store the values in this object (for Learn UI support). Do not use for model training.

    - #### IterationResult

          public IterationResult​(double threshold)

      Initializes all values to 0. Use only when calculating statistics for custom threshold and existing dataset, not for model training.
      Parameters:
        `threshold` - - a custom threshold between 0 and 1

  - ### Method Detail

    - #### clone

          public COErrorRate.IterationResult clone()

      Performs shallow copy of all simple types.
      Overrides:
        `clone` in class `java.lang.Object`

    - #### getNFalseExamples

          public int getNFalseExamples()

      Returns:
        number of accumulated examples with "False" label

    - #### getNTrueExamples

          public int getNTrueExamples()

      Returns:
        number of accumulated examples with "True" label

    - #### getNExamples

          public int getNExamples()

      Returns:
        total number of accumulated examples

    - #### getNErrors

          public int getNErrors()

      Returns:
        number of encountered errors. Includes errors with 0 prediction confidence.

    - #### getNFalsePos

          public int getNFalsePos()

      Returns:
        number of false positives, including the ones with 0 prediction confidence.

    - #### getNFalseNeg

          public int getNFalseNeg()

      Returns:
        number of false negatives, including the ones with 0 prediction confidence.

    - #### getNUntrainedPred

          public int getNUntrainedPred()

      Returns the number of examples that cannot be reliably predicted. Such examples have 0 prediction confidence. This happens when a submodel that predicts such example is completely untrained, or feature scores of the example are in an untrained or completely contradictory region of the submodel. More examples from the same subset and with similar feature scores should be added to the training dataset before using the trained model.
      Returns:
        number of examples that are predicted with 0 confidence.

    - #### getTotalConf

          public double getTotalConf()

      Returns:
        total confidence for all examples (sum of all confidence values).

    - #### errorRate

          public double errorRate()

      Returns:
        error rate. Includes errors with 0 prediction confidence.

    - #### falsePosRate

          public double falsePosRate()

      Returns:
        false positive rate. Includes false positives with 0 prediction confidence.

    - #### falseNegRate

          public double falseNegRate()

      Returns:
        false negative rate. Includes false negatives with 0 prediction confidence.

    - #### noPredictionRate

          public double noPredictionRate()

      Returns the percentage of examples that cannot be reliably predicted. See `getNUntrainedPred()` for details about such examples.
      Returns:
        untrained prediction rate - the percentage of examples that have 0 prediction confidence.

    - #### meanConf

          public double meanConf()

      Returns:
        mean prediction confidence for all examples

    - #### meanErrConf

          public double meanErrConf()

      Returns:
        mean prediction confidence for incorrectly classified examples

    - #### meanDist

          public double meanDist()

      Returns:
        mean distance between the model prediction score and the actual label (0 or 1) for all examples

    - #### meanErrDist

          public double meanErrDist()

      Returns:
        mean distance between the model prediction score and the actual label (0 or 1) for incorrectly classified examples

    - #### isConverged

          public boolean isConverged​(double targetErrorRate)

      Returns true if the target error rate has been reached. The error rate includes the errors for examples predicted with 0 confidence (see `getNUntrainedPred()` for more details). Some of these errors may be from submodels that are never trained, so model training will have no impact for these errors.
      Returns:
        true if the error rate of the last training iteration is below the target error rate.

    - #### isConverged

          public boolean isConverged()

      Returns true if the default target error rate has been reached. See `isConverged(double)`.
      Returns:
        true if the error rate of the last training iteration is below the default target error rate.

    - #### isPerfectResult

          public boolean isPerfectResult()

      Returns:
        true if all examples in the dataset were predicted correctly.

    - #### addPrediction

          public void addPrediction​(RLinkOut prediction,
                                    boolean label)

      Updates all stored statistics based on the additional model prediction.
      Parameters:
        `prediction` - - the new model prediction
        `label` - - the actual label that had to be predicted