Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## cc.mallet.types
Class ROCData

    java.lang.Object
      cc.mallet.types.ROCData

All Implemented Interfaces:
  AlphabetCarrying, java.io.Serializable

    public class ROCData

extends java.lang.Object
implements AlphabetCarrying, java.io.Serializable

Tracks ROC data for instances in `Trial` results.

Author:
  Michael Bond mikejbond@gmail.com
See Also:
  `Trial`, `InstanceList`, `Classifier`, `Classification`, Serialized Form

Field Summary
`static int` | `FALSE_NEGATIVE`
`static int` | `FALSE_POSITIVE`
`static int` | `TRUE_NEGATIVE`
`static int` | `TRUE_POSITIVE`

Constructor Summary
`ROCData(double[] thresholds, LabelAlphabet labelAlphabet)` Constructs a new object

Method Summary
`void` | `add(Classification classification)` Adds classification results to the ROC data
`void` | `add(ROCData rocData)` Adds existing ROC data to this ROC data
`void` | `add(Trial trial)` Adds trial results to the ROC data
`Alphabet` | `getAlphabet()`
`Alphabet[]` | `getAlphabets()`
`int[][]` | `getCounts(Label label)` Gets the raw counts for a specified label.
`int[]` | `getCounts(Label label, double threshold)` Gets the raw counts for a specified label and threshold.
`LabelAlphabet` | `getLabelAlphabet()` Gets the label alphabet
`double` | `getPositivePercent(Label label, double threshold)` Gets the estimated percentage of training events that exceed the threshold.
`double` | `getPrecision(Label label, double threshold)` Gets the precision for a specified label and threshold.
`double` | `getPrecisionForScore(Label label, double score)` Gets the precision for a specified label and score.
`double` | `getRecall(Label label, double threshold)` Gets the recall rate for a specified label and threshold.
`double[]` | `getThresholds()` Gets the thresholds being tracked
`void` | `setCounts(Label label, double threshold, int[] newCounts)` Sets the raw counts for a specified label and threshold.
`java.lang.String` | `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### TRUE_POSITIVE

    public static final int TRUE_POSITIVE

See Also:
  Constant Field Values

### FALSE_POSITIVE

    public static final int FALSE_POSITIVE

See Also:
  Constant Field Values

### FALSE_NEGATIVE

    public static final int FALSE_NEGATIVE

See Also:
  Constant Field Values

### TRUE_NEGATIVE

    public static final int TRUE_NEGATIVE

See Also:
  Constant Field Values

Constructor Detail

### ROCData

    public ROCData(double[] thresholds,
                   LabelAlphabet labelAlphabet)

  Constructs a new object

  Parameters:
    `thresholds` - Array of thresholds to track counts for
    `labelAlphabet` - Label alphabet for instances in `Trial`

Method Detail

### add

    public void add(Classification classification)

  Adds classification results to the ROC data

  Parameters:
    `trial` - Trial results to add to ROC data

### add

    public void add(Trial trial)

  Adds trial results to the ROC data

  Parameters:
    `trial` - Trial results to add to ROC data

### add

    public void add(ROCData rocData)

  Adds existing ROC data to this ROC data

  Parameters:
    `rocData` - ROC data to add

### getAlphabet

    public Alphabet getAlphabet()

  Specified by:
    `getAlphabet` in interface `AlphabetCarrying`

### getAlphabets

    public Alphabet[] getAlphabets()

  Specified by:
    `getAlphabets` in interface `AlphabetCarrying`

### getCounts

    public int[][] getCounts(Label label)

  Gets the raw counts for a specified label.

  Parameters:
    `label` - Label to get counts for
  Returns:
    Array of raw counts for specified label
  See Also:
    `TRUE_POSITIVE`, `FALSE_POSITIVE`, `FALSE_NEGATIVE`, `TRUE_NEGATIVE`

### getCounts

    public int[] getCounts(Label label,
                           double threshold)

  Gets the raw counts for a specified label and threshold. If data was not collected for the exact threshold specified, then results for the highest threshold <= the specified threshold will be returned.

  Parameters:
    `label` - Label to get counts for
    `threshold` - Threshold to get counts for
  Returns:
    Array of raw counts for specified label and threshold
  See Also:
    `TRUE_POSITIVE`, `FALSE_POSITIVE`, `FALSE_NEGATIVE`, `TRUE_NEGATIVE`

### getLabelAlphabet

    public LabelAlphabet getLabelAlphabet()

  Gets the label alphabet

### getPrecision

    public double getPrecision(Label label,
                               double threshold)

  Gets the precision for a specified label and threshold. If data was not collected for the exact threshold specified, then results will for the highest threshold <= the specified threshold will be returned.

  Parameters:
    `label` - Label to get precision for
    `threshold` - Threshold to get precision for
  Returns:
    Precision for specified label and threshold

### getPrecisionForScore

    public double getPrecisionForScore(Label label,
                                       double score)

  Gets the precision for a specified label and score. This differs from `ROCData.getPrecision(Label, double)` in that it is the precision for only scores falling in the one score value, not for all scores above the threshold. If data was not collected for the exact threshold specified, then results will for the highest threshold <= the specified threshold will be returned.

  Parameters:
    `label` - Label to get precision for
    `threshold` - Threshold to get precision for
  Returns:
    Precision for specified label and score

### getPositivePercent

    public double getPositivePercent(Label label,
                                     double threshold)

  Gets the estimated percentage of training events that exceed the threshold.

  Parameters:
    `label` - Label to get precision for
    `threshold` - Threshold to get precision for
  Returns:
    Estimated percentage of events exceeding threshold

### getRecall

    public double getRecall(Label label,
                            double threshold)

  Gets the recall rate for a specified label and threshold. If data was not collected for the exact threshold specified, then results will for the highest threshold <= the specified threshold will be returned.

  Parameters:
    `label` - Label to get recall for
    `threshold` - Threshold to get recall for
  Returns:
    Recall rate for specified label and threshold

### getThresholds

    public double[] getThresholds()

  Gets the thresholds being tracked

  Returns:
    Array of thresholds

### setCounts

    public void setCounts(Label label,
                          double threshold,
                          int[] newCounts)

  Sets the raw counts for a specified label and threshold. If data is not collected for the exact threshold specified, then counts for the highest threshold <= the specified threshold will be set.

  Parameters:
    `label` - Label to get counts for
    `threshold` - Threshold to get counts for
    `newCounts` - New count values for the label and threshold
  See Also:
    `TRUE_POSITIVE`, `FALSE_POSITIVE`, `FALSE_NEGATIVE`, `TRUE_NEGATIVE`

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD