Package cc.mallet.cluster.iterator
Class ClusterSampleIterator
- java.lang.Object
-
- cc.mallet.cluster.iterator.NeighborIterator
-
- cc.mallet.cluster.iterator.PairSampleIterator
-
- cc.mallet.cluster.iterator.ClusterSampleIterator
-
- All Implemented Interfaces:
java.util.Iterator<Instance>
- Direct Known Subclasses:
NodeClusterSampleIterator
public class ClusterSampleIterator extends PairSampleIterator
Sample clusters of Instances.- Since:
- 1.0
- Version:
- 1.0
- Author:
- "Aron Culotta"
-
-
Field Summary
-
Fields inherited from class cc.mallet.cluster.iterator.PairSampleIterator
instances, nonsingletonClusters, numberSamples, positiveCount, positiveProportion, positiveTarget, random, totalCount
-
Fields inherited from class cc.mallet.cluster.iterator.NeighborIterator
clustering
-
-
Constructor Summary
Constructors Constructor Description ClusterSampleIterator(Clustering clustering, Randoms random, double positiveProportion, int numberSamples)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Instance
next()
protected int[]
sampleFromArray(int[] a, Randoms random, int minSize)
Samples a subset of elements from this array.protected int[][]
sampleSplitFromArray(int[] a, Randoms random, int minSize)
Samples a two disjoint subset of elements from this array.-
Methods inherited from class cc.mallet.cluster.iterator.PairSampleIterator
hasNext
-
Methods inherited from class cc.mallet.cluster.iterator.NeighborIterator
getClustering, remove
-
-
-
-
Constructor Detail
-
ClusterSampleIterator
public ClusterSampleIterator(Clustering clustering, Randoms random, double positiveProportion, int numberSamples)
- Parameters:
clustering
- True clustering.random
- Source of randomness.positiveProportion
- Proportion of Instances that should be positive examples.numberSamples
- Total number of samples to generate.
-
-
Method Detail
-
next
public Instance next()
- Specified by:
next
in interfacejava.util.Iterator<Instance>
- Overrides:
next
in classPairSampleIterator
-
sampleFromArray
protected int[] sampleFromArray(int[] a, Randoms random, int minSize)
Samples a subset of elements from this array.- Parameters:
a
-random
-- Returns:
-
sampleSplitFromArray
protected int[][] sampleSplitFromArray(int[] a, Randoms random, int minSize)
Samples a two disjoint subset of elements from this array.- Parameters:
a
-random
-- Returns:
-
-