Codota Logo
InitializeStandard_F64
Code IndexAdd Codota to your IDE (free)

How to use
InitializeStandard_F64
in
org.ddogleg.clustering.kmeans

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

  • Common ways to obtain InitializeStandard_F64
private void myMethod () {
InitializeStandard_F64 i =
  • Codota Iconnew InitializeStandard_F64()
  • Smart code suggestions by Codota
}
origin: lessthanoptimal/ddogleg

  @Override
  public InitializeKMeans_F64 createAlg() {
    return new InitializeStandard_F64();
  }
}
origin: org.ddogleg/ddogleg

seed = new InitializeStandard_F64();
break;
origin: lessthanoptimal/ddogleg

seed = new InitializeStandard_F64();
break;
origin: lessthanoptimal/ddogleg

  @Override
  public ComputeClusters<double[]> createClustersAlg( boolean hint ) {

    if( hint ) {
      return new ExpectationMaximizationGmm_F64(1000, 1e-8, seeds);
    } else {
      InitializeStandard_F64 kseeds = new InitializeStandard_F64();
      StandardKMeans_F64 kmeans = new StandardKMeans_F64(1000,1000,1e-8,kseeds);
      SeedFromKMeans_F64 seeds = new SeedFromKMeans_F64(kmeans);
      return new ExpectationMaximizationGmm_F64(1000, 1e-8, seeds);
    }
  }
}
origin: lessthanoptimal/ddogleg

@Override
public ComputeClusters<double[]> createClustersAlg( boolean hint ) {
  if( hint ) {
    // assume the first 3 are in different groups for the seeds
    return new StandardKMeans_F64(1000,1000, 1e-8, new FixedSeeds());
  } else {
    InitializeStandard_F64 seeds = new InitializeStandard_F64();
    return new StandardKMeans_F64(1000,1000, 1e-8, seeds );
  }
}
origin: lessthanoptimal/ddogleg

@Test
public void matchPointsToClusters() {
  StandardKMeans_F64 alg = new StandardKMeans_F64(100,100,1,new InitializeStandard_F64());
  alg.init(4, 123);
  alg.clusters.resize(3);
  alg.workClusters.resize(3);
  alg.memberCount.resize(3);
  alg.clusters.data[0] = new double[]{20,0,0,0};
  alg.clusters.data[1] = new double[]{0,20,0,0};
  alg.clusters.data[2] = new double[]{0,0,20,0};
  List<double[]> points = new ArrayList<double[]>();
  points.add( new double[]{20,5,0,0});
  points.add( new double[]{25,-4,0,0});
  points.add( new double[]{0,0,22,0});
  alg.matchPointsToClusters(points);
  assertEquals(2,alg.memberCount.get(0));
  assertEquals(0,alg.memberCount.get(1));
  assertEquals(1,alg.memberCount.get(2));
  assertEquals(45,alg.workClusters.data[0][0],1e-8);
  assertEquals(1 ,alg.workClusters.data[0][1],1e-8);
  assertEquals(0 ,alg.workClusters.data[0][2],1e-8);
  assertEquals(0 ,alg.workClusters.data[0][3],1e-8);
  assertEquals(0 ,alg.workClusters.data[1][1],1e-8);
  assertEquals(22,alg.workClusters.data[2][2],1e-8);
}
origin: lessthanoptimal/ddogleg

@Test
public void updateClusterCenters() {
  StandardKMeans_F64 alg = new StandardKMeans_F64(100,100,1,new InitializeStandard_F64());
  alg.init(4,123);
  alg.clusters.resize(3);
  alg.workClusters.resize(3);
  alg.memberCount.resize(3);
  double orig[][] = new double[3][4];
  orig[0] = new double[]{10,20,30,20};
  orig[1] = new double[]{20,10,30,40};
  orig[2] = new double[]{3,9,1,12};
  alg.workClusters.data[0] = orig[0].clone();
  alg.workClusters.data[1] = orig[1].clone();
  alg.workClusters.data[2] = orig[2].clone();
  alg.memberCount.data[0] = 10;
  alg.memberCount.data[1] = 1;
  alg.memberCount.data[2] = 3;
  // previous clusters will be near zero
  alg.updateClusterCenters();
  for (int i = 0; i < 4; i++) {
    assertEquals(alg.clusters.data[0][i],orig[0][i]/10);
    assertEquals(alg.clusters.data[1][i],orig[1][i]/1);
    assertEquals(alg.clusters.data[2][i],orig[2][i]/3);
  }
}
org.ddogleg.clustering.kmeansInitializeStandard_F64

Javadoc

Seeds are selects by randomly picking points. This is the standard way to initialize k-means

Most used methods

  • <init>

Popular in Java

  • Making http requests using okhttp
  • startActivity (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • orElseThrow (Optional)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • Vector (java.util)
    The Vector class implements a growable array of objects. Like an array, it contains components that
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