Class GPD

  • All Implemented Interfaces:
    Serializable, Cloneable, weka.classifiers.Classifier, weka.core.BatchPredictor, weka.core.CapabilitiesHandler, weka.core.CapabilitiesIgnorer, weka.core.CommandlineRunnable, weka.core.OptionHandler, weka.core.RevisionHandler, weka.core.TechnicalInformationHandler, weka.core.WeightedInstancesHandler

    public class GPD
    extends weka.classifiers.AbstractClassifier
    implements weka.core.WeightedInstancesHandler, weka.core.OptionHandler, weka.core.TechnicalInformationHandler
    Implements Gaussian Processes for regression without hyperparameter-tuning, with an inline RBF kernel.
    For more information see

    David J.C. Mackay (1998). Introduction to Gaussian Processes. Dept. of Physics, Cambridge University, UK.

    BibTeX:

     @misc{Mackay1998,
        address = {Dept. of Physics, Cambridge University, UK},
        author = {David J.C. Mackay},
        title = {Introduction to Gaussian Processes},
        year = {1998},
        PS = {http://wol.ra.phy.cam.ac.uk/mackay/gpB.ps.gz}
     }
     

    Valid options are:

     -output-debug-info
      If set, classifier is run in debug mode and
      may output additional info to the console
     -do-not-check-capabilities
      If set, classifier capabilities are not checked before classifier is built
      (use with caution).
     -L <double>
      Level of Gaussian Noise.
      (default: 0.01)
     -G <double>
      Gamma for the RBF kernel.
      (default: 0.01)
     -N
      Whether to 0=normalize/1=standardize/2=neither.
      (default: 0=normalize)
     -output-debug-info
      If set, classifier is run in debug mode and
      may output additional info to the console
     -do-not-check-capabilities
      If set, classifier capabilities are not checked before classifier is built
      (use with caution).
    Author:
    Kurt Driessens ([email protected]), Bernhard Pfahringer ([email protected])
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int FILTER_NONE
      no filter
      static int FILTER_NORMALIZE
      normalizes the data
      static int FILTER_STANDARDIZE
      standardizes the data
      protected double m_Alin
      The parameters of the linear transforamtion realized by the filter on the class attribute
      protected double m_avg_target
      The training data.
      protected double m_Blin  
      protected boolean m_checksTurnedOff
      Turn off all checks and conversions? Turning them off assumes that data is purely numeric, doesn't contain any missing values, and has a numeric class.
      protected int m_classIndex
      The class index from the training data
      protected double[][] m_data  
      protected double m_delta
      Gaussian Noise Value.
      protected GaussianProcessesNoWeights m_FallBack
      the fallback model.
      protected weka.filters.Filter m_Filter
      The filter used to standardize/normalize all values.
      protected int m_filterType
      Whether to normalize/standardize/neither
      protected double m_gamma  
      protected weka.filters.unsupervised.attribute.ReplaceMissingValues m_Missing
      The filter used to get rid of missing values.
      protected weka.filters.unsupervised.attribute.NominalToBinary m_NominalToBinary
      The filter used to make attributes numeric.
      protected int m_NumTrain
      The number of training instances
      protected double[] m_t
      The vector of target values.
      static weka.core.Tag[] TAGS_FILTER
      The filter to apply to the training data
      • Fields inherited from class weka.classifiers.AbstractClassifier

        BATCH_SIZE_DEFAULT, m_BatchSize, m_Debug, m_DoNotCheckCapabilities, m_numDecimalPlaces, NUM_DECIMAL_PLACES_DEFAULT
    • Constructor Summary

      Constructors 
      Constructor Description
      GPD()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void buildClassifier​(weka.core.Instances insts)
      Method for building the classifier.
      protected double[][] choleskyDecomposition​(double[][] A)
      Cholesky decomposition.
      double classifyInstance​(weka.core.Instance inst)
      Classifies a given instance.
      String filterTypeTipText()
      Returns the tip text for this property.
      String gammaTipText()
      Returns the tip text for this property.
      weka.core.Capabilities getCapabilities()
      Returns default capabilities of the classifier.
      weka.core.SelectedTag getFilterType()
      Gets how the training data will be transformed.
      double getGamma()
      Returns the gamma for the RBF kernel.
      double getNoise()
      Get the value of noise.
      String[] getOptions()
      Gets the current settings of the classifier.
      String getRevision()
      Returns the revision string.
      weka.core.TechnicalInformation getTechnicalInformation()
      Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.
      String globalInfo()
      Returns a string describing classifier
      Enumeration listOptions()
      Returns an enumeration describing the available options.
      static void main​(String[] args)
      Main method for testing this class.
      String noiseTipText()
      Returns the tip text for this property.
      protected double rbfKernel​(double[] x, double[] y, double gamma)
      Computes the RBF kernel.
      void setFilterType​(weka.core.SelectedTag newType)
      Sets how the training data will be transformed.
      void setGamma​(double v)
      Set the gamma for the RBF kernel.
      void setNoise​(double v)
      Set the level of Gaussian Noise.
      void setOptions​(String[] options)
      Parses a given list of options.
      protected double[] solveChol​(double[][] L, double[] b)
      specialised to solve A * x = b, where x and b are one-dimensional
      protected double squaredDistance​(double[] x, double[] y)
      Computes the squared distance.
      String toString()
      Prints out the classifier.
      • Methods inherited from class weka.classifiers.AbstractClassifier

        batchSizeTipText, debugTipText, distributionForInstance, distributionsForInstances, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, implementsMoreEfficientBatchPrediction, makeCopies, makeCopy, numDecimalPlacesTipText, postExecution, preExecution, run, runClassifier, setBatchSize, setDebug, setDoNotCheckCapabilities, setNumDecimalPlaces
    • Field Detail

      • m_NominalToBinary

        protected weka.filters.unsupervised.attribute.NominalToBinary m_NominalToBinary
        The filter used to make attributes numeric.
      • FILTER_NORMALIZE

        public static final int FILTER_NORMALIZE
        normalizes the data
        See Also:
        Constant Field Values
      • FILTER_STANDARDIZE

        public static final int FILTER_STANDARDIZE
        standardizes the data
        See Also:
        Constant Field Values
      • TAGS_FILTER

        public static final weka.core.Tag[] TAGS_FILTER
        The filter to apply to the training data
      • m_Filter

        protected weka.filters.Filter m_Filter
        The filter used to standardize/normalize all values.
      • m_filterType

        protected int m_filterType
        Whether to normalize/standardize/neither
      • m_Missing

        protected weka.filters.unsupervised.attribute.ReplaceMissingValues m_Missing
        The filter used to get rid of missing values.
      • m_checksTurnedOff

        protected boolean m_checksTurnedOff
        Turn off all checks and conversions? Turning them off assumes that data is purely numeric, doesn't contain any missing values, and has a numeric class.
      • m_delta

        protected double m_delta
        Gaussian Noise Value.
      • m_classIndex

        protected int m_classIndex
        The class index from the training data
      • m_data

        protected double[][] m_data
      • m_gamma

        protected double m_gamma
      • m_Alin

        protected double m_Alin
        The parameters of the linear transforamtion realized by the filter on the class attribute
      • m_Blin

        protected double m_Blin
      • m_NumTrain

        protected int m_NumTrain
        The number of training instances
      • m_avg_target

        protected double m_avg_target
        The training data.
      • m_t

        protected double[] m_t
        The vector of target values.
    • Constructor Detail

      • GPD

        public GPD()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing classifier
        Returns:
        a description suitable for displaying in the explorer/experimenter gui
      • getTechnicalInformation

        public weka.core.TechnicalInformation getTechnicalInformation()
        Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.
        Specified by:
        getTechnicalInformation in interface weka.core.TechnicalInformationHandler
        Returns:
        the technical information about this class
      • listOptions

        public Enumeration listOptions()
        Returns an enumeration describing the available options.
        Specified by:
        listOptions in interface weka.core.OptionHandler
        Overrides:
        listOptions in class weka.classifiers.AbstractClassifier
        Returns:
        an enumeration of all the available options.
      • setOptions

        public void setOptions​(String[] options)
                        throws Exception
        Parses a given list of options.
        Specified by:
        setOptions in interface weka.core.OptionHandler
        Overrides:
        setOptions in class weka.classifiers.AbstractClassifier
        Parameters:
        options - the list of options as an array of strings
        Throws:
        Exception - if an option is not supported
      • getOptions

        public String[] getOptions()
        Gets the current settings of the classifier.
        Specified by:
        getOptions in interface weka.core.OptionHandler
        Overrides:
        getOptions in class weka.classifiers.AbstractClassifier
        Returns:
        an array of strings suitable for passing to setOptions
      • setFilterType

        public void setFilterType​(weka.core.SelectedTag newType)
        Sets how the training data will be transformed. Should be one of FILTER_NORMALIZE, FILTER_STANDARDIZE, FILTER_NONE.
        Parameters:
        newType - the new filtering mode
      • getFilterType

        public weka.core.SelectedTag getFilterType()
        Gets how the training data will be transformed. Will be one of FILTER_NORMALIZE, FILTER_STANDARDIZE, FILTER_NONE.2200Instances
        Returns:
        the filtering mode
      • filterTypeTipText

        public String filterTypeTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the explorer/experimenter gui
      • setNoise

        public void setNoise​(double v)
        Set the level of Gaussian Noise.
        Parameters:
        v - Value to assign to noise.
      • getNoise

        public double getNoise()
        Get the value of noise.
        Returns:
        Value of noise.
      • noiseTipText

        public String noiseTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the explorer/experimenter gui
      • setGamma

        public void setGamma​(double v)
        Set the gamma for the RBF kernel.
        Parameters:
        v - the gamma
      • getGamma

        public double getGamma()
        Returns the gamma for the RBF kernel.
        Returns:
        the gamma
      • gammaTipText

        public String gammaTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the explorer/experimenter gui
      • getCapabilities

        public weka.core.Capabilities getCapabilities()
        Returns default capabilities of the classifier.
        Specified by:
        getCapabilities in interface weka.core.CapabilitiesHandler
        Specified by:
        getCapabilities in interface weka.classifiers.Classifier
        Overrides:
        getCapabilities in class weka.classifiers.AbstractClassifier
        Returns:
        the capabilities of this classifier
      • choleskyDecomposition

        protected double[][] choleskyDecomposition​(double[][] A)
        Cholesky decomposition.
        Parameters:
        A - the matrix.
        Returns:
        the decomposition
      • solveChol

        protected double[] solveChol​(double[][] L,
                                     double[] b)
        specialised to solve A * x = b, where x and b are one-dimensional
      • squaredDistance

        protected double squaredDistance​(double[] x,
                                         double[] y)
        Computes the squared distance.
        Parameters:
        x -
        y -
        Returns:
      • rbfKernel

        protected double rbfKernel​(double[] x,
                                   double[] y,
                                   double gamma)
        Computes the RBF kernel.
        Parameters:
        x -
        y -
        gamma -
        Returns:
      • buildClassifier

        public void buildClassifier​(weka.core.Instances insts)
                             throws Exception
        Method for building the classifier.
        Specified by:
        buildClassifier in interface weka.classifiers.Classifier
        Parameters:
        insts - the set of training instances
        Throws:
        Exception - if the classifier can't be built successfully
      • classifyInstance

        public double classifyInstance​(weka.core.Instance inst)
                                throws Exception
        Classifies a given instance.
        Specified by:
        classifyInstance in interface weka.classifiers.Classifier
        Overrides:
        classifyInstance in class weka.classifiers.AbstractClassifier
        Parameters:
        inst - the instance to be classified
        Returns:
        the classification
        Throws:
        Exception - if instance could not be classified successfully
      • toString

        public String toString()
        Prints out the classifier.
        Overrides:
        toString in class Object
        Returns:
        a description of the classifier as a string
      • getRevision

        public String getRevision()
        Returns the revision string.
        Specified by:
        getRevision in interface weka.core.RevisionHandler
        Overrides:
        getRevision in class weka.classifiers.AbstractClassifier
        Returns:
        the revision
      • main

        public static void main​(String[] args)
        Main method for testing this class.
        Parameters:
        args - the commandline parameters