Interface AffinityMatrix

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      double get​(int i, int j)
      Get an entry by absolute position.
      int iter​(int x)
      Iterator over non-zero features only.
      int iterAdvance​(int x, int iter)
      Advance the iterator to the next position.
      DBIDArrayIter iterDBIDs()
      Array iterator over the stored objects.
      int iterDim​(int x, int iter)
      Get the dimension an iterator points to.
      boolean iterValid​(int x, int iter)
      Test the iterator position for validity.
      double iterValue​(int x, int iter)
      Get the value an iterator points to.
      void scale​(double d)
      Scale the whole matrix with a constant factor d.
      int size()
      Number of rows.
    • Method Detail

      • scale

        void scale​(double d)
        Scale the whole matrix with a constant factor d. This is used to add/remove early exaggeration of tSNE.
        Parameters:
        d - Scaling factor.
      • size

        int size()
        Number of rows.
        Returns:
        Size
      • get

        double get​(int i,
                   int j)
        Get an entry by absolute position. Note: this may be expensive on sparse matrixes.
        Parameters:
        i - Row
        j - Column
        Returns:
        Entry
      • iter

        int iter​(int x)
        Iterator over non-zero features only. Note: depending on the underlying implementation, this may or may not be the dimension. Use iterDim(int, int) to get the actual dimension. In fact, usually this will be the ith non-zero value, assuming an array representation. Think of this number as an iterator. But for efficiency, it has a primitive type, so it does not require garbage collection. With Java 10 value types, we will likely be able to make this both type-safe and highly efficient again. Intended usage:
         
         for (int iter = v.iter(x); v.iterValid(x, iter); iter = v.iterAdvance(x, iter)) {
           final int dim = v.iterDim(x, iter);
           final int val = v.iterValue(x, iter);
         }
         
         
        Important: you need to use the return value of iterAdvance for the next iteration, or you will have an endless loop.
        Parameters:
        x - Point to get the neighbors for
        Returns:
        Identifier for the first non-zero dimension, not necessarily the dimension!
      • iterDim

        int iterDim​(int x,
                    int iter)
        Get the dimension an iterator points to.
        Parameters:
        iter - Iterator position
        Returns:
        Dimension the iterator refers to
      • iterValue

        double iterValue​(int x,
                         int iter)
        Get the value an iterator points to.
        Parameters:
        iter - Iterator position
        Returns:
        Dimension the iterator refers to
      • iterAdvance

        int iterAdvance​(int x,
                        int iter)
        Advance the iterator to the next position.
        Parameters:
        iter - Previous iterator position
        Returns:
        Next iterator position
      • iterValid

        boolean iterValid​(int x,
                          int iter)
        Test the iterator position for validity.
        Parameters:
        iter - Iterator position
        Returns:
        true when it refers to a valid position.
      • iterDBIDs

        DBIDArrayIter iterDBIDs()
        Array iterator over the stored objects.
        Returns:
        DBID iterator