NeighborIterator iter = new ClusterSampleIterator(clustering, random, 0.5,
public Instance next () { AgglomerativeNeighbor neighbor = null; if ((positiveCount < positiveTarget || clustering.getNumClusters() == 1) && nonsingletonClusters.length > 0) { positiveCount++; int label = nonsingletonClusters[random.nextInt(nonsingletonClusters.length)]; int[] instances = clustering.getIndicesWithLabel(label); int[][] clusters = sampleSplitFromArray(instances, random, 2); neighbor = new AgglomerativeNeighbor(clustering, clustering, clusters); } else { int labeli = random.nextInt(clustering.getNumClusters()); int labelj = random.nextInt(clustering.getNumClusters()); while (labeli == labelj) labelj = random.nextInt(clustering.getNumClusters()); neighbor = new AgglomerativeNeighbor(clustering, ClusterUtils.copyAndMergeClusters(clustering, labeli, labelj), sampleFromArray(clustering.getIndicesWithLabel(labeli), random, 1), sampleFromArray(clustering.getIndicesWithLabel(labelj), random, 1)); } totalCount++; return new Instance(neighbor, null, null, null); }
public Instance next () { AgglomerativeNeighbor neighbor = null; if ((positiveCount < positiveTarget || clustering.getNumClusters() == 1) && nonsingletonClusters.length > 0) { positiveCount++; int label = nonsingletonClusters[random.nextInt(nonsingletonClusters.length)]; int[] instances = clustering.getIndicesWithLabel(label); int[][] clusters = sampleSplitFromArray(instances, random, 2); neighbor = new AgglomerativeNeighbor(clustering, clustering, clusters); } else { int labeli = random.nextInt(clustering.getNumClusters()); int labelj = random.nextInt(clustering.getNumClusters()); while (labeli == labelj) labelj = random.nextInt(clustering.getNumClusters()); neighbor = new AgglomerativeNeighbor(clustering, ClusterUtils.copyAndMergeClusters(clustering, labeli, labelj), sampleFromArray(clustering.getIndicesWithLabel(labeli), random, 1), sampleFromArray(clustering.getIndicesWithLabel(labelj), random, 1)); } totalCount++; return new Instance(neighbor, null, null, null); }
NeighborIterator iter = new ClusterSampleIterator(clustering, random, 0.5,
public Instance next () { AgglomerativeNeighbor neighbor = null; if ((positiveCount < positiveTarget || clustering.getNumClusters() == 1) && nonsingletonClusters.length > 0) { positiveCount++; int label = nonsingletonClusters[random.nextInt(nonsingletonClusters.length)]; int[] instances = clustering.getIndicesWithLabel(label); int[][] clusters = sampleSplitFromArray(instances, random, 2); neighbor = new AgglomerativeNeighbor(clustering, clustering, clusters); } else { int labeli = random.nextInt(clustering.getNumClusters()); int labelj = random.nextInt(clustering.getNumClusters()); while (labeli == labelj) labelj = random.nextInt(clustering.getNumClusters()); neighbor = new AgglomerativeNeighbor(clustering, ClusterUtils.copyAndMergeClusters(clustering, labeli, labelj), sampleFromArray(clustering.getIndicesWithLabel(labeli), random, 1), sampleFromArray(clustering.getIndicesWithLabel(labelj), random, 1)); } totalCount++; return new Instance(neighbor, null, null, null); }
NeighborIterator iter = new ClusterSampleIterator(clustering, random, 0.5,
System.err.println("Training with " + training); InstanceList trainList = new InstanceList(clusterPipe); trainList.addThruPipe(new ClusterSampleIterator(training, random, 0.5, 100)); System.err.println("Created " + trainList.size() + " instances."); Classifier me = new MaxEntTrainer().train(trainList);
System.err.println("Training with " + training); InstanceList trainList = new InstanceList(clusterPipe); trainList.addThruPipe(new ClusterSampleIterator(training, random, 0.5, 100)); System.err.println("Created " + trainList.size() + " instances."); Classifier me = new MaxEntTrainer().train(trainList);
System.err.println("Training with " + training); InstanceList trainList = new InstanceList(clusterPipe); trainList.addThruPipe(new ClusterSampleIterator(training, random, 0.5, 100)); System.err.println("Created " + trainList.size() + " instances."); Classifier me = new MaxEntTrainer().train(trainList);