next up previous index
Next: Stratified Sampling Up: Sampler Class Previous: Sampler Class   Index


Weighted Sampling

weighted_sampling is a child class of Sampler class. It randomly samples alternatives from choice population with probability proportion to their weights. Its run() method accepts the following arguments:

dataset1
- an instance of Dataset, to be used as agent set.
dataset2
- an instance of Dataset, to be used as choice set.
index1
- indices of dataset1 for whom alternatives are sampled. If it is not given, all elements of dataset1 are used.
index2
- indices of dataset2 from which alternatives are sampled. If it is not given, all elements of dataset2 are used.
sample_size
- number of alternatives sampled.
weight
- an array used as weight for elements of dataset2 in unequal probability sampling; it has to be either of None, or of the same size as index2 or dataset2. If it is not given, sampling is proceeded with equal probability.
include_chosen_choice
- whether agents' chosen choice will be included in the return results. If it's true, the chosen choices are in the first column of the return results.
resources
- an instance of Resources that can be used to pass any of the above arguments to the run method.


next up previous index
Next: Stratified Sampling Up: Sampler Class Previous: Sampler Class   Index
info (at) urbansim.org