Next: Specification and Coefficients
Up: Sampler Class
Previous: weighted_sampling
Index
stratified_sampling
stratified_sampling is a child class of Sampler class.
It randomly samples alternatives from choice population according to
their stratum setting. 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.
- stratum
- - an array indicates the stratum id for elements of dataset2; it has
to be either of None, or of the same size as index2 or dataset2. If it's not given,
all elements are treated as in 1 stratum.
- weight
- - like in weighted_sampling, weight is 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.
- sample_size
- - number of alternatives sampled from one stratum; default value is 1.
- sample_size_from_chosen_stratum
- - number of alternatives sampled from agent's chosen stratum.
If it's None, it's equal to value specified by sample_size or sample|_rate.
- sample_rate
- - calculate number of alternatives sampled from one stratum by multiplying this rate with
number of observations in this stratum. If both sample_rate and sample_size are specified, use sample_rate.
- 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 run method.
Next: Specification and Coefficients
Up: Sampler Class
Previous: weighted_sampling
Index
info (at) urbansim.org