/** * Construct the assigner using the given cluster data and * distance function. * * @param data the cluster data * @param comparison the distance function */ public ExactByteAssigner(byte[][] data, ByteFVComparator comparison) { nn = new ByteNearestNeighboursExact(data, comparison); }
@Override public int[] assign(int[][] data) { int [] argmins = new int [data.length]; float [] mins = new float [data.length]; nn.searchNN(data, argmins, mins); return argmins; }
@Override public int[] assign(float[][] data) { int [] argmins = new int [data.length]; float [] mins = new float [data.length]; nn.searchNN(data, argmins, mins); return argmins; }
@Override public int[][] assign(double[][] data) { int [][] indices = new int [data.length][numNeighbours]; double [][] distances = new double [data.length][numNeighbours]; nn.searchKNN(data, numNeighbours, indices, distances); return indices; }
@Override public DoubleNearestNeighboursExact create(double[][] data) { return new DoubleNearestNeighboursExact(data, distance); } }
@Override public IntNearestNeighboursExact create(int[][] data) { return new IntNearestNeighboursExact(data, distance); } }
/** * Construct the assigner using the given cluster data and * distance function. * * @param data the cluster data * @param comparison the distance function */ public ExactFloatAssigner(float[][] data, FloatFVComparator comparison) { nn = new FloatNearestNeighboursExact(data, comparison); }
@Override public int[][] assign(byte[][] data) { int [][] indices = new int [data.length][numNeighbours]; float [][] distances = new float [data.length][numNeighbours]; nn.searchKNN(data, numNeighbours, indices, distances); return indices; }
@Override public ShortNearestNeighboursExact create(short[][] data) { return new ShortNearestNeighboursExact(data, distance); } }
@Override public int[][] assign(short[][] data) { int [][] indices = new int [data.length][numNeighbours]; float [][] distances = new float [data.length][numNeighbours]; nn.searchKNN(data, numNeighbours, indices, distances); return indices; }
/** * Construct the assigner using the given cluster data and * distance function. * * @param data the cluster data * @param comparison the distance function */ public ExactLongAssigner(long[][] data, LongFVComparator comparison) { nn = new LongNearestNeighboursExact(data, comparison); }
/** * @param eps * @param minPts */ public DoubleNNDBSCAN(double eps, int minPts) { this(eps,minPts,new DoubleNearestNeighboursExact.Factory()); } class NNRegionMode implements RegionMode<IntDoublePair>{
@Override public int[] assign(long[][] data) { int [] argmins = new int [data.length]; double [] mins = new double [data.length]; nn.searchNN(data, argmins, mins); return argmins; }
public NNRegionMode(double[][] data) { this.data = data; this.nn = nnf.create(data); } @Override
@Override public DoubleNearestNeighboursExact create(double[][] data) { return new DoubleNearestNeighboursExact(data, distance); } }
/** * Construct the assigner using the given cluster data and * distance function. * * @param data the cluster data * @param comparison the distance function */ public ExactIntAssigner(int[][] data, IntFVComparator comparison) { nn = new IntNearestNeighboursExact(data, comparison); }
@Override public ByteNearestNeighboursExact create(byte[][] data) { return new ByteNearestNeighboursExact(data, distance); } }
@Override public FloatNearestNeighboursExact create(float[][] data) { return new FloatNearestNeighboursExact(data, distance); } }
/** * Construct the assigner using the given cluster data and * distance function. * * @param data the cluster data * @param comparison the distance function */ public ExactDoubleAssigner(double[][] data, DoubleFVComparator comparison) { nn = new DoubleNearestNeighboursExact(data, comparison); }
@Override public IntNearestNeighboursExact create(int[][] data) { return new IntNearestNeighboursExact(data, distance); } }