Package se.hb.jcp.cp

Class ConformalMultiProbabilisticClassifier

  • All Implemented Interfaces:
    java.io.Serializable, IConformalClassifier, IClassifierInformation

    public class ConformalMultiProbabilisticClassifier
    extends java.lang.Object
    implements IConformalClassifier, java.io.Serializable
    Represents a multi-probabilistic conformal classifier with bivariate isotonic regression. See [C. Zhou, "Conformal and Venn Predictors for Multi-probabilistic Predictions and Their Applications", Ph.D. Thesis, Department of Computer Science, Royal Holloway, University of London, 2015] for the details. NOTE: The description in the Thesis above is not completely clear so the implementation here is partially done by educated guesses. Updated proofs of the desired properties remain to be done.
    Author:
    anders.gidenstam(at)hb.se
    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void calibrate​(cern.colt.matrix.DoubleMatrix2D xcal, double[] ycal)
      Calibrates this multi-probabilistic conformal classifier using the supplied data.
      int getAttributeCount()
      Returns the number of attributes the classifier has been trained on.
      IConformalClassifier getConformalClassifier()
      Returns the underlying conformal classifier.
      java.lang.Double[] getLabels()
      Returns the set of class labels the classifier has been trained on.
      IClassificationNonconformityFunction getNonconformityFunction()
      Returns the associated nonconformity function.
      boolean isTrained()
      Returns whether this classifier has been trained and calibrated.
      cern.colt.matrix.DoubleMatrix1D nativeStorageTemplate()
      Returns a value of the DoubleMatrix1D derived class that is the native storage format for the classifier.
      ConformalMultiProbabilisticClassification predict​(cern.colt.matrix.DoubleMatrix1D x)
      Makes a prediction for the instance x.
      ConformalMultiProbabilisticClassification[] predict​(cern.colt.matrix.DoubleMatrix2D x)
      Makes a prediction for each instance in x.
      cern.colt.matrix.DoubleMatrix1D predictPValues​(cern.colt.matrix.DoubleMatrix1D x)
      Computes the predicted p-values for the instance x.
      void predictPValues​(cern.colt.matrix.DoubleMatrix1D x, cern.colt.matrix.DoubleMatrix1D pValues)
      Computes the predicted p-values for the instance x.
      cern.colt.matrix.DoubleMatrix2D predictPValues​(cern.colt.matrix.DoubleMatrix2D x)
      Computes the predicted p-values for each target and instance in x.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ConformalMultiProbabilisticClassifier

        public ConformalMultiProbabilisticClassifier​(IConformalClassifier classifier)
        Creates a multi-probabilistic conformal classifier with bivariate isotonic regression using the supplied information.
        Parameters:
        classifier - the trained conformal classifier to use.
    • Method Detail

      • calibrate

        public void calibrate​(cern.colt.matrix.DoubleMatrix2D xcal,
                              double[] ycal)
        Calibrates this multi-probabilistic conformal classifier using the supplied data.
        Parameters:
        xcal - the attributes of the calibration instances.
        ycal - the targets of the calibration instances.
      • predict

        public ConformalMultiProbabilisticClassification[] predict​(cern.colt.matrix.DoubleMatrix2D x)
        Makes a prediction for each instance in x. The method is parallellized over the instances.
        Specified by:
        predict in interface IConformalClassifier
        Parameters:
        x - the instances.
        Returns:
        an array containing a ConformalMultiProbabilisticClassification for each instance.
      • predictPValues

        public cern.colt.matrix.DoubleMatrix2D predictPValues​(cern.colt.matrix.DoubleMatrix2D x)
        Description copied from interface: IConformalClassifier
        Computes the predicted p-values for each target and instance in x. The method is parallellized over the instances.
        Specified by:
        predictPValues in interface IConformalClassifier
        Parameters:
        x - the instances.
        Returns:
        an DoubleMatrix2D containing the predicted p-values for each instance.
      • predictPValues

        public cern.colt.matrix.DoubleMatrix1D predictPValues​(cern.colt.matrix.DoubleMatrix1D x)
        Description copied from interface: IConformalClassifier
        Computes the predicted p-values for the instance x.
        Specified by:
        predictPValues in interface IConformalClassifier
        Parameters:
        x - the instance.
        Returns:
        an DoubleMatrix1D containing the predicted p-values.
      • predictPValues

        public void predictPValues​(cern.colt.matrix.DoubleMatrix1D x,
                                   cern.colt.matrix.DoubleMatrix1D pValues)
        Description copied from interface: IConformalClassifier
        Computes the predicted p-values for the instance x.
        Specified by:
        predictPValues in interface IConformalClassifier
        Parameters:
        x - the instance.
        pValues - an initialized DoubleMatrix1D to store the p-values.
      • getConformalClassifier

        public IConformalClassifier getConformalClassifier()
        Returns the underlying conformal classifier.
        Returns:
        the underlying conformal classifier.
      • isTrained

        public boolean isTrained()
        Returns whether this classifier has been trained and calibrated.
        Specified by:
        isTrained in interface IClassifierInformation
        Returns:
        true if the classifier has been trained and calibrated or false otherwise.
      • getAttributeCount

        public int getAttributeCount()
        Description copied from interface: IClassifierInformation
        Returns the number of attributes the classifier has been trained on.
        Specified by:
        getAttributeCount in interface IClassifierInformation
        Returns:
        Returns the number of attributes the classifier has been trained on or -1 if the classifier has not been trained.
      • getLabels

        public java.lang.Double[] getLabels()
        Description copied from interface: IClassifierInformation
        Returns the set of class labels the classifier has been trained on.
        Specified by:
        getLabels in interface IClassifierInformation
        Returns:
        Returns the class labels the classifier has been trained on in increasing order (the index is the class id) or null if the classifier has not been trained.
      • nativeStorageTemplate

        public cern.colt.matrix.DoubleMatrix1D nativeStorageTemplate()
        Description copied from interface: IClassifierInformation
        Returns a value of the DoubleMatrix1D derived class that is the native storage format for the classifier.
        Specified by:
        nativeStorageTemplate in interface IClassifierInformation
        Returns:
        a value of the DoubleMatrix1D derived class of the native storage format for the classifier.