Codota Logo
InitializeKMeans_F64.selectSeeds
Code IndexAdd Codota to your IDE (free)

How to use
selectSeeds
method
in
org.ddogleg.clustering.kmeans.InitializeKMeans_F64

Best Java code snippets using org.ddogleg.clustering.kmeans.InitializeKMeans_F64.selectSeeds (Showing top 7 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
StringBuilder s =
  • Codota Iconnew StringBuilder()
  • Codota Iconnew StringBuilder(32)
  • Codota IconString str;new StringBuilder(str)
  • Smart code suggestions by Codota
}
origin: lessthanoptimal/ddogleg

seedSelector.selectSeeds(points, clusters.toList());
      System.out.println(iteration+"  Reseeding: "+sumDistance);
    seedSelector.selectSeeds(points, clusters.toList());
    previousSum = Double.MAX_VALUE;
    lastConverge = iteration;
origin: org.ddogleg/ddogleg

seedSelector.selectSeeds(points, clusters.toList());
      System.out.println(iteration+"  Reseeding: "+sumDistance);
    seedSelector.selectSeeds(points, clusters.toList());
    previousSum = Double.MAX_VALUE;
    lastConverge = iteration;
origin: lessthanoptimal/ddogleg

/**
 * In this situation there are not enough unique points which can act as unique seeds
 */
@Test
public void notEnoughUniquePoints() {
  int DOF = 20;
  List<double[]> points = TestStandardKMeans_F64.createPoints(DOF,30,true);
  for (int i = 1; i < points.size(); i += 2) {
    System.arraycopy(points.get(i-1),0,points.get(i),0,DOF);
  }
  List<double[]> seeds = TestStandardKMeans_F64.createPoints(DOF,20,false);
  InitializeKMeans_F64 alg = createAlg();
  alg.init(DOF,0xBEEF);
  alg.selectSeeds(points, seeds);
  // just make sure it found a match in the input set
  for( double[] a : seeds ) {
    findMatch( a , points );
  }
}
origin: lessthanoptimal/ddogleg

alg.selectSeeds(points,seeds);
origin: lessthanoptimal/ddogleg

@Test
public void selectSeeds() {
  int DOF = 20;
  InitializeKMeans_F64 alg = createAlg();
  alg.init(DOF,0xBEEF);
  List<double[]> points = TestStandardKMeans_F64.createPoints(DOF,100,true);
  List<double[]> seeds = TestStandardKMeans_F64.createPoints(DOF,20,false);
  alg.selectSeeds(points,seeds);
  // make sure nothing was added to the list
  assertEquals(20,seeds.size());
  for (int i = 0; i < seeds.size(); i++) {
    double[] s = seeds.get(i);
    // make sure the seed was written to
    for (int j = 0; j < DOF; j++) {
      assertTrue(s[j]!=0);
    }
    // make sure it wasn't swapped with one of the points
    for (int j = 0; j < points.size(); j++) {
      assertTrue(points.get(j) != s);
    }
  }
}
origin: lessthanoptimal/ddogleg

/**
 * In this situation there are not enough unique points which can act as unique seeds.
 *
 * This is a stricter version of generic test
 */
@Test
public void notEnoughUniquePoints_strict() {
  int DOF = 20;
  List<double[]> points = TestStandardKMeans_F64.createPoints(DOF,30,true);
  for (int i = 1; i < points.size(); i += 2) {
    System.arraycopy(points.get(i-1),0,points.get(i),0,DOF);
  }
  List<double[]> seeds = TestStandardKMeans_F64.createPoints(DOF,20,false);
  InitializeKMeans_F64 alg = createAlg();
  alg.init(DOF,0xBEEF);
  alg.selectSeeds(points, seeds);
  int hits[] = new int[15];
  for( double[] a : seeds ) {
    int match = findMatch( a , points )/2;
    hits[match]++;
  }
  // make sure each one was selected at least once
  for (int i = 0; i < hits.length; i++) {
    assertTrue(hits[i] > 0);
  }
}
origin: lessthanoptimal/ddogleg

/**
 * Request more seeds than there are points.  This is impossible to do and ensure the seeds are
 * unique.
 */
@Test
public void impossible() {
  try {
    int DOF = 20;
    InitializeKMeans_F64 alg = createAlg();
    alg.init(DOF,0xBEEF);
    // 4 points and 4 seeds.  Each point must be a seed
    List<double[]> points = TestStandardKMeans_F64.createPoints(DOF,3,true);
    List<double[]> seeds = TestStandardKMeans_F64.createPoints(DOF,4,false);
    alg.selectSeeds(points,seeds);
    fail("Should have thrown an exception!");
  } catch( Exception e ) {
  }
}
org.ddogleg.clustering.kmeansInitializeKMeans_F64selectSeeds

Javadoc

Given the set of points select reasonable seeds.

Duplicate Points: If there duplicate points in the input list it should not crash. This is true even if the number of unique points is less than the number of requested seeds. All the seeds will be filled but they do not need to be unique.

Popular methods of InitializeKMeans_F64

  • init
    Initializes internal data structures. Must be called first.

Popular in Java

  • Making http requests using okhttp
  • getApplicationContext (Context)
  • findViewById (Activity)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • InputStreamReader (java.io)
    An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes
  • DecimalFormat (java.text)
    DecimalFormat is a concrete subclass ofNumberFormat that formats decimal numbers. It has a variety o
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Timer (java.util)
    A facility for threads to schedule tasks for future execution in a background thread. Tasks may be s
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now