/** * Given a path, get the cluster centroid associated with the cluster index of the path. * @param path * @return the centroid of a given path */ public byte [] getClusterCentroid(int [] path) { Node node = root; for (int i=0; i<path.length-1; i++) { node = node.children[path[i]]; } return node.result.getCentroids()[path[path.length-1]]; }
/** * Given a path, get the cluster centroid associated with the cluster index of the path. * @param path * @return the centroid of a given path */ public int [] getClusterCentroid(int [] path) { Node node = root; for (int i=0; i<path.length-1; i++) { node = node.children[path[i]]; } return node.result.getCentroids()[path[path.length-1]]; }
/** * Given a path, get the cluster centroid associated with the cluster index of the path. * @param path * @return the centroid of a given path */ public long [] getClusterCentroid(int [] path) { Node node = root; for (int i=0; i<path.length-1; i++) { node = node.children[path[i]]; } return node.result.getCentroids()[path[path.length-1]]; }
@Override public int[][] performClustering(float[][] data) { FloatCentroidsResult clusters = this.cluster(data); return new IndexClusters(clusters.defaultHardAssigner().assign(data)).clusters(); }
@Override public int[][] performClustering(byte[][] data) { ByteCentroidsResult clusters = this.cluster(data); return new IndexClusters(clusters.defaultHardAssigner().assign(data)).clusters(); }
@Override public int[][] performClustering(byte[][] data) { ByteCentroidsResult res = this.cluster(data); return new IndexClusters(res.defaultHardAssigner().assign(data)).clusters(); }
@Override public int[][] performClustering(float[][] data) { FloatCentroidsResult res = this.cluster(data); return new IndexClusters(res.defaultHardAssigner().assign(data)).clusters(); }
@Override public int[][] performClustering(int[][] data) { IntCentroidsResult res = this.cluster(data); return new IndexClusters(res.defaultHardAssigner().assign(data)).clusters(); }
@Override public int[][] performClustering(long[][] data) { LongCentroidsResult clusters = this.cluster(data); return new IndexClusters(clusters.defaultHardAssigner().assign(data)).clusters(); }
@Override public int[][] performClustering(double[][] data) { DoubleCentroidsResult res = this.cluster(data); return new IndexClusters(res.defaultHardAssigner().assign(data)).clusters(); }
@Override public int[][] performClustering(short[][] data) { ShortCentroidsResult clusters = this.cluster(data); return new IndexClusters(clusters.defaultHardAssigner().assign(data)).clusters(); }
@Override public int[][] performClustering(long[][] data) { LongCentroidsResult res = this.cluster(data); return new IndexClusters(res.defaultHardAssigner().assign(data)).clusters(); }
@Override public int[][] performClustering(double[][] data) { DoubleCentroidsResult clusters = this.cluster(data); return new IndexClusters(clusters.defaultHardAssigner().assign(data)).clusters(); }
@Override public int[][] performClustering(short[][] data) { ShortCentroidsResult res = this.cluster(data); return new IndexClusters(res.defaultHardAssigner().assign(data)).clusters(); }
/** * * @param c the underlying {@link IndexClusters} * @param valvects the eigen values and vectors */ public SpectralIndexedClusters(IndexClusters c, IndependentPair<double[], double[][]>valvects) { this.clusters = c.clusters(); this.nEntries = c.numEntries(); this.valvects = valvects; }
/** * Construct with the given assigner and the centroids associated with the * assigner. * * @param assigner * the assigner * @param centroids * the centroids associated with the assigner * @param normalise * if true then output feature is l2 normalised */ public VLAD(HardAssigner<T, ?, ?> assigner, CentroidsProvider<T> centroids, boolean normalise) { this(assigner, centroids.getCentroids(), normalise); }
/** * Given a path, get the cluster centroid associated with the cluster index of the path. * @param path * @return the centroid of a given path */ public float [] getClusterCentroid(int [] path) { Node node = root; for (int i=0; i<path.length-1; i++) { node = node.children[path[i]]; } return node.result.getCentroids()[path[path.length-1]]; }
/** * Given a path, get the cluster centroid associated with the cluster index of the path. * @param path * @return the centroid of a given path */ public short [] getClusterCentroid(int [] path) { Node node = root; for (int i=0; i<path.length-1; i++) { node = node.children[path[i]]; } return node.result.getCentroids()[path[path.length-1]]; }
/** * Given a path, get the cluster centroid associated with the cluster index of the path. * @param path * @return the centroid of a given path */ public double [] getClusterCentroid(int [] path) { Node node = root; for (int i=0; i<path.length-1; i++) { node = node.children[path[i]]; } return node.result.getCentroids()[path[path.length-1]]; }
/** * Construct with the given assigner and the centroids associated with the * assigner. * * @param assigner * the assigner * @param centroids * the centroids associated with the assigner * @param normalise * if true then output feature is l2 normalised */ public VLAD(HardAssigner<T, ?, ?> assigner, CentroidsProvider<T> centroids, boolean normalise) { this(assigner, centroids.getCentroids(), normalise); }