Tabnine Logo
AnderbergHierarchicalClustering
Code IndexAdd Tabnine to your IDE (free)

How to use
AnderbergHierarchicalClustering
in
de.lmu.ifi.dbs.elki.algorithm.clustering.hierarchical

Best Java code snippets using de.lmu.ifi.dbs.elki.algorithm.clustering.hierarchical.AnderbergHierarchicalClustering (Showing top 20 results out of 315)

origin: elki-project/elki

 @Override
 protected AnderbergHierarchicalClustering<O> makeInstance() {
  return new AnderbergHierarchicalClustering<>(distanceFunction, linkage);
 }
}
origin: de.lmu.ifi.dbs.elki/elki

/**
 * Update the cache.
 *
 * @param size Working set size
 * @param scratch Scratch matrix
 * @param bestd Best distance
 * @param besti Best index
 * @param x First cluster
 * @param y Second cluster, {@code y < x}
 * @param j Updated value d(y, j)
 * @param d New distance
 */
private void updateCache(int size, double[] scratch, double[] bestd, int[] besti, int x, int y, int j, double d) {
 // New best
 if(d <= bestd[j]) {
  bestd[j] = d;
  besti[j] = y;
  return;
 }
 // Needs slow upate.
 if(besti[j] == x || besti[j] == y) {
  findBest(size, scratch, bestd, besti, j);
 }
}
origin: elki-project/elki

merge(size, mat, bestd, besti, builder, mindist, x, y);
return x;
origin: elki-project/elki

 LOG.verbose("Notice: SLINK is a much faster algorithm for single-linkage clustering!");
DistanceQuery<O> dq = db.getDistanceQuery(relation, getDistanceFunction());
final DBIDs ids = relation.getDBIDs();
MatrixParadigm mat = new MatrixParadigm(ids);
initializeNNCache(mat.matrix, bestd, besti);
for(int i = 1, end = size; i < size; i++) {
   findMerge(end, mat, bestd, besti, builder));
 LOG.incrementProcessed(prog);
origin: elki-project/elki

builder.add(ix, linkage.restore(mindist, getDistanceFunction().isSquared()), iy);
updateMatrix(size, mat.matrix, iy, bestd, besti, builder, mindist, x, y, sizex, sizey);
if(besti[y] == x) {
 findBest(size, mat.matrix, bestd, besti, y);
origin: de.lmu.ifi.dbs.elki/elki

updateMatrix(size, scratch, iy, bestd, besti, builder, mindist, x, y, sizex, sizey);
if(besti[y] == x) {
 findBest(size, scratch, bestd, besti, y);
origin: elki-project/elki

@Override
public TypeInformation[] getInputTypeRestriction() {
 // The input relation must match our distance function:
 return TypeUtil.array(getDistanceFunction().getInputTypeRestriction());
}
origin: elki-project/elki

final int yb = ybase + j;
final double d = scratch[yb] = linkage.combine(sizex, scratch[xbase + j], sizey, scratch[yb], sizej, mindist);
updateCache(size, scratch, bestd, besti, x, y, j, d);
final int jb = jbase + y;
final double d = scratch[jb] = linkage.combine(sizex, scratch[xbase + j], sizey, scratch[jb], sizej, mindist);
updateCache(size, scratch, bestd, besti, x, y, j, d);
final int jb = jbase + y;
final double d = scratch[jb] = linkage.combine(sizex, scratch[jbase + x], sizey, scratch[jb], sizej, mindist);
updateCache(size, scratch, bestd, besti, x, y, j, d);
origin: de.lmu.ifi.dbs.elki/elki-clustering

 LOG.verbose("Notice: SLINK is a much faster algorithm for single-linkage clustering!");
DistanceQuery<O> dq = db.getDistanceQuery(relation, getDistanceFunction());
final DBIDs ids = relation.getDBIDs();
MatrixParadigm mat = new MatrixParadigm(ids);
initializeNNCache(mat.matrix, bestd, besti);
for(int i = 1, end = size; i < size; i++) {
   findMerge(end, mat, bestd, besti, builder));
 LOG.incrementProcessed(prog);
origin: de.lmu.ifi.dbs.elki/elki-clustering

builder.add(ix, linkage.restore(mindist, getDistanceFunction().isSquared()), iy);
updateMatrix(size, mat.matrix, iy, bestd, besti, builder, mindist, x, y, sizex, sizey);
if(besti[y] == x) {
 findBest(size, mat.matrix, bestd, besti, y);
origin: de.lmu.ifi.dbs.elki/elki

@Override
public TypeInformation[] getInputTypeRestriction() {
 // The input relation must match our distance function:
 return TypeUtil.array(getDistanceFunction().getInputTypeRestriction());
}
origin: de.lmu.ifi.dbs.elki/elki

final int yb = ybase + j;
final double d = scratch[yb] = linkage.combine(sizex, scratch[xbase + j], sizey, scratch[yb], sizej, mindist);
updateCache(size, scratch, bestd, besti, x, y, j, d);
final int jb = jbase + y;
final double d = scratch[jb] = linkage.combine(sizex, scratch[xbase + j], sizey, scratch[jb], sizej, mindist);
updateCache(size, scratch, bestd, besti, x, y, j, d);
updateCache(size, scratch, bestd, besti, x, y, j, d);
origin: de.lmu.ifi.dbs.elki/elki

DistanceQuery<O> dq = db.getDistanceQuery(relation, getDistanceFunction());
ArrayDBIDs ids = DBIDUtil.ensureArray(relation.getDBIDs());
final int size = ids.size();
initializeNNCache(scratch, bestd, besti);
int wsize = size;
for(int i = 1; i < size; i++) {
 int x = findMerge(wsize, scratch, ix, iy, bestd, besti, builder);
 if(x == wsize - 1) {
  --wsize;
origin: de.lmu.ifi.dbs.elki/elki

 @Override
 protected AnderbergHierarchicalClustering<O> makeInstance() {
  return new AnderbergHierarchicalClustering<>(distanceFunction, linkage);
 }
}
origin: de.lmu.ifi.dbs.elki/elki-clustering

@Override
public TypeInformation[] getInputTypeRestriction() {
 // The input relation must match our distance function:
 return TypeUtil.array(getDistanceFunction().getInputTypeRestriction());
}
origin: elki-project/elki

/**
 * Update the cache.
 *
 * @param size Working set size
 * @param scratch Scratch matrix
 * @param bestd Best distance
 * @param besti Best index
 * @param x First cluster
 * @param y Second cluster, {@code y < x}
 * @param j Updated value d(y, j)
 * @param d New distance
 */
private void updateCache(int size, double[] scratch, double[] bestd, int[] besti, int x, int y, int j, double d) {
 // New best
 if(d <= bestd[j]) {
  bestd[j] = d;
  besti[j] = y;
  return;
 }
 // Needs slow update.
 if(besti[j] == x || besti[j] == y) {
  findBest(size, scratch, bestd, besti, j);
 }
}
origin: de.lmu.ifi.dbs.elki/elki

merge(size, scratch, ix, iy, bestd, besti, builder, mindist, x < y ? y : x, x < y ? x : y);
return x;
origin: de.lmu.ifi.dbs.elki/elki-clustering

final int yb = ybase + j;
final double d = scratch[yb] = linkage.combine(sizex, scratch[xbase + j], sizey, scratch[yb], sizej, mindist);
updateCache(size, scratch, bestd, besti, x, y, j, d);
final int jb = jbase + y;
final double d = scratch[jb] = linkage.combine(sizex, scratch[xbase + j], sizey, scratch[jb], sizej, mindist);
updateCache(size, scratch, bestd, besti, x, y, j, d);
final int jb = jbase + y;
final double d = scratch[jb] = linkage.combine(sizex, scratch[jbase + x], sizey, scratch[jb], sizej, mindist);
updateCache(size, scratch, bestd, besti, x, y, j, d);
origin: de.lmu.ifi.dbs.elki/elki-clustering

 @Override
 protected AnderbergHierarchicalClustering<O> makeInstance() {
  return new AnderbergHierarchicalClustering<>(distanceFunction, linkage);
 }
}
origin: de.lmu.ifi.dbs.elki/elki-clustering

/**
 * Update the cache.
 *
 * @param size Working set size
 * @param scratch Scratch matrix
 * @param bestd Best distance
 * @param besti Best index
 * @param x First cluster
 * @param y Second cluster, {@code y < x}
 * @param j Updated value d(y, j)
 * @param d New distance
 */
private void updateCache(int size, double[] scratch, double[] bestd, int[] besti, int x, int y, int j, double d) {
 // New best
 if(d <= bestd[j]) {
  bestd[j] = d;
  besti[j] = y;
  return;
 }
 // Needs slow update.
 if(besti[j] == x || besti[j] == y) {
  findBest(size, scratch, bestd, besti, j);
 }
}
de.lmu.ifi.dbs.elki.algorithm.clustering.hierarchicalAnderbergHierarchicalClustering

Javadoc

This is a modification of the classic AGNES algorithm for hierarchical clustering using a nearest-neighbor heuristic for acceleration.

Instead of scanning the matrix (with cost O(n²)) to find the minimum, the nearest neighbor of each object is remembered. On the downside, we need to check these values at every merge, and it may now cost O(n²) to perform a merge, so there is no worst-case advantage to this approach. The average case however improves from O(n³) to O(n²), which yields a considerable improvement in running time.

This optimization is attributed to M. R. Anderberg.

Reference:

M. R. Anderberg
Hierarchical Clustering Methods
Cluster Analysis for Applications
ISBN: 0120576503

Most used methods

  • <init>
    Constructor.
  • findBest
  • findMerge
    Perform the next merge step. Due to the cache, this is now O(n) each time, instead of O(n*n).
  • getDistanceFunction
  • initializeNNCache
    Initialize the NN cache.
  • merge
    Execute the cluster merge.
  • updateCache
    Update the cache.
  • updateMatrix
    Update the scratch distance matrix.

Popular in Java

  • Updating database using SQL prepared statement
  • onCreateOptionsMenu (Activity)
  • getSharedPreferences (Context)
  • getSupportFragmentManager (FragmentActivity)
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now