T
- the type of elements to be selected among@Deprecated
public class MultiRandSelector<T>
extends java.lang.Object
For example, given data about incomes by state, it may be more useful to select 1000 people from each state rather than 50,000 from the nation. As another example, for selecting invocations in a Daikon trace file, it may be more useful to select an equal number of samples per program point.
The performance is the same as running a set of RandomSelector Objects, one for each bucket, plus some overhead for determining which bucket to assign to each Object in the iteration.
To use this class, call this.accept() on every Object in the iteration to be sampled. Then, call valuesIter() to receive an iteration of all the values selected by the random selection.
RandomSelector
Constructor and Description |
---|
MultiRandSelector(double keep_prob,
Partitioner<T,T> eq)
Deprecated.
|
MultiRandSelector(double keep_prob,
java.util.Random r,
Partitioner<T,T> eq)
Deprecated.
|
MultiRandSelector(int num_elts,
Partitioner<T,T> eq)
Deprecated.
|
MultiRandSelector(int num_elts,
java.util.Random r,
Partitioner<T,T> eq)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(T next)
Deprecated.
|
void |
acceptIter(java.util.Iterator<T> iter)
Deprecated.
|
java.util.Map<T,RandomSelector<T>> |
values()
Deprecated.
|
java.util.Iterator<T> |
valuesIter()
Deprecated.
Returns an iterator of all objects selected.
|
public MultiRandSelector(int num_elts, Partitioner<T,T> eq)
num_elts
- the number of elements to select from each bucketeq
- partioner that determines how to partition the objects from the iterationpublic MultiRandSelector(double keep_prob, Partitioner<T,T> eq)
public MultiRandSelector(int num_elts, java.util.Random r, Partitioner<T,T> eq)
public MultiRandSelector(double keep_prob, java.util.Random r, Partitioner<T,T> eq)
public void acceptIter(java.util.Iterator<T> iter)
public void accept(T next)
public java.util.Map<T,RandomSelector<T>> values()
public java.util.Iterator<T> valuesIter()