Class SVR_Q

  • All Implemented Interfaces:
    QMatrix

    public class SVR_Q
    extends java.lang.Object
    implements QMatrix
    Q matrix used for regression by EpsilonSVR and NuSVR.

    This uses two "copies" of the data, one for upper bounding and one for lower bounding of the data, yielding a virtual size of 2*l.

    To save memory, we cache inside, to avoid duplication.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int[] index  
      private CachedQMatrix inner  
      private int l  
      private double[] QD  
      private byte[] sign  
    • Constructor Summary

      Constructors 
      Constructor Description
      SVR_Q​(DataSet x, double cache_size)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void get_Q​(int i, int len, float[] out)
      Get a column of the matrix.
      double[] get_QD()
      Get the diagonal values, as reference.
      void initialize()
      Initialize the Q Matrix.
      double similarity​(int i, int j)
      (Slow) compute the similarity (not distance) of objects i and j.
      void swap_index​(int i, int j)
      Reorganize the data by swapping two entries.
      • Methods inherited from class java.lang.Object

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

      • l

        private final int l
      • sign

        private final byte[] sign
      • index

        private final int[] index
      • QD

        private final double[] QD
    • Constructor Detail

      • SVR_Q

        public SVR_Q​(DataSet x,
                     double cache_size)
    • Method Detail

      • initialize

        public void initialize()
        Description copied from interface: QMatrix
        Initialize the Q Matrix.
        Specified by:
        initialize in interface QMatrix
      • get_QD

        public double[] get_QD()
        Description copied from interface: QMatrix
        Get the diagonal values, as reference.
        Specified by:
        get_QD in interface QMatrix
        Returns:
        Diagonal values
      • swap_index

        public void swap_index​(int i,
                               int j)
        Description copied from interface: QMatrix
        Reorganize the data by swapping two entries.

        This also must modify the QD array!

        Specified by:
        swap_index in interface QMatrix
        Parameters:
        i - First entry
        j - Second entry
      • get_Q

        public void get_Q​(int i,
                          int len,
                          float[] out)
        Description copied from interface: QMatrix
        Get a column of the matrix.
        Specified by:
        get_Q in interface QMatrix
        Parameters:
        i - Column number
        len - Number of entries to get
        out - Output array for similarity values
      • similarity

        public double similarity​(int i,
                                 int j)
        Description copied from interface: QMatrix
        (Slow) compute the similarity (not distance) of objects i and j.

        If you need many, use QMatrix.get_Q(int, int, float[]) instead.

        Specified by:
        similarity in interface QMatrix
        Parameters:
        i - First object
        j - Second object
        Returns:
        Similarity