Search in sources :

Example 1 with LocalitySensitiveHashFunction

use of de.lmu.ifi.dbs.elki.index.lsh.hashfunctions.LocalitySensitiveHashFunction in project elki by elki-project.

the class AbstractProjectedHashFunctionFamily method generateHashFunctions.

@Override
public ArrayList<? extends LocalitySensitiveHashFunction<? super NumberVector>> generateHashFunctions(Relation<? extends NumberVector> relation, int l) {
    int dim = RelationUtil.dimensionality(relation);
    ArrayList<LocalitySensitiveHashFunction<? super NumberVector>> ps = new ArrayList<>(l);
    final Random rnd = random.getSingleThreadedRandom();
    for (int i = 0; i < l; i++) {
        RandomProjectionFamily.Projection mat = proj.generateProjection(dim, k);
        ps.add(new MultipleProjectionsLocalitySensitiveHashFunction(mat, width, rnd));
    }
    return ps;
}
Also used : Random(java.util.Random) NumberVector(de.lmu.ifi.dbs.elki.data.NumberVector) LocalitySensitiveHashFunction(de.lmu.ifi.dbs.elki.index.lsh.hashfunctions.LocalitySensitiveHashFunction) MultipleProjectionsLocalitySensitiveHashFunction(de.lmu.ifi.dbs.elki.index.lsh.hashfunctions.MultipleProjectionsLocalitySensitiveHashFunction) ArrayList(java.util.ArrayList) RandomProjectionFamily(de.lmu.ifi.dbs.elki.data.projection.random.RandomProjectionFamily) MultipleProjectionsLocalitySensitiveHashFunction(de.lmu.ifi.dbs.elki.index.lsh.hashfunctions.MultipleProjectionsLocalitySensitiveHashFunction)

Example 2 with LocalitySensitiveHashFunction

use of de.lmu.ifi.dbs.elki.index.lsh.hashfunctions.LocalitySensitiveHashFunction in project elki by elki-project.

the class CosineHashFunctionFamily method generateHashFunctions.

@Override
public ArrayList<? extends LocalitySensitiveHashFunction<? super NumberVector>> generateHashFunctions(Relation<? extends NumberVector> relation, int l) {
    int dim = RelationUtil.dimensionality(relation);
    ArrayList<LocalitySensitiveHashFunction<? super NumberVector>> ps = new ArrayList<>(l);
    for (int i = 0; i < l; i++) {
        RandomProjectionFamily.Projection projection = proj.generateProjection(dim, k);
        ps.add(new CosineLocalitySensitiveHashFunction(projection));
    }
    return ps;
}
Also used : NumberVector(de.lmu.ifi.dbs.elki.data.NumberVector) LocalitySensitiveHashFunction(de.lmu.ifi.dbs.elki.index.lsh.hashfunctions.LocalitySensitiveHashFunction) CosineLocalitySensitiveHashFunction(de.lmu.ifi.dbs.elki.index.lsh.hashfunctions.CosineLocalitySensitiveHashFunction) ArrayList(java.util.ArrayList) CosineLocalitySensitiveHashFunction(de.lmu.ifi.dbs.elki.index.lsh.hashfunctions.CosineLocalitySensitiveHashFunction) RandomProjectionFamily(de.lmu.ifi.dbs.elki.data.projection.random.RandomProjectionFamily) LessEqualConstraint(de.lmu.ifi.dbs.elki.utilities.optionhandling.constraints.LessEqualConstraint)

Aggregations

NumberVector (de.lmu.ifi.dbs.elki.data.NumberVector)2 RandomProjectionFamily (de.lmu.ifi.dbs.elki.data.projection.random.RandomProjectionFamily)2 LocalitySensitiveHashFunction (de.lmu.ifi.dbs.elki.index.lsh.hashfunctions.LocalitySensitiveHashFunction)2 ArrayList (java.util.ArrayList)2 CosineLocalitySensitiveHashFunction (de.lmu.ifi.dbs.elki.index.lsh.hashfunctions.CosineLocalitySensitiveHashFunction)1 MultipleProjectionsLocalitySensitiveHashFunction (de.lmu.ifi.dbs.elki.index.lsh.hashfunctions.MultipleProjectionsLocalitySensitiveHashFunction)1 LessEqualConstraint (de.lmu.ifi.dbs.elki.utilities.optionhandling.constraints.LessEqualConstraint)1 Random (java.util.Random)1