Class MutableLSH<E>

java.lang.Object
smile.neighbor.LSH<E>
smile.neighbor.MutableLSH<E>
Type Parameters:
E - the type of data objects in the hash table.
All Implemented Interfaces:
Serializable, KNNSearch<double[],E>, RNNSearch<double[],E>

public class MutableLSH<E> extends LSH<E>
Mutable LSH.
See Also:
  • Constructor Details

    • MutableLSH

      public MutableLSH(int d, int L, int k, double w)
      Constructor.
      Parameters:
      d - the dimensionality of data.
      L - the number of hash tables.
      k - the number of random projection hash functions, which is usually set to log(N) where N is the dataset size.
      w - the width of random projections. It should be sufficiently away from 0. But we should not choose a w value that is too large, which will increase the query time.
  • Method Details

    • put

      public void put(double[] key, E value)
      Description copied from class: LSH
      Insert an item into the hash table.
      Overrides:
      put in class LSH<E>
      Parameters:
      key - the key.
      value - the value.
    • remove

      public void remove(double[] key, E value)
      Remove an entry from the hash table.
      Parameters:
      key - the key.
      value - the value.
    • update

      public void update(double[] key, E value)
      Update an entry with new key. Note that the new key and old key should not be the same object.
      Parameters:
      key - the key.
      value - the value.
    • keys

      public List<double[]> keys()
      Returns the keys.
      Returns:
      the keys.
    • values

      public List<E> values()
      Returns the values.
      Returns:
      the values.