def __init__(self, proposal_set, sampler="opus_core.samplers.weighted_sampler", weight_string = None, run_config=None, estimate_config=None, debuglevel=0, dataset_pool=None, filter="development_project_proposal.status_id==%s" % DevelopmentProjectProposalDataset.id_tentative, choice_attribute_name='is_chosen', **kwargs): self.id_selected = 9 self.proposal_set = proposal_set self.filter = filter self.choice_attribute_name = copy.copy(choice_attribute_name) ChoiceModel.__init__(self, [1, 2], choice_attribute_name=choice_attribute_name, **kwargs) DevelopmentProjectProposalSamplingModel.__init__(self, proposal_set, sampler="opus_core.samplers.weighted_sampler", weight_string = "development_project_proposal.status_id==%s" % self.id_selected, #weight_string = "development_project_proposal.status_id==%s" % self.id_selected, run_config=run_config, estimate_config=estimate_config, debuglevel=debuglevel, dataset_pool=dataset_pool)
def __init__(self, choice_set=[0, 1], location_id_name="grid_id", movers_ratio=None, **kwargs): self.location_id_name = location_id_name self.movers_ratio = movers_ratio ChoiceModel.__init__(self, choice_set, **kwargs)
def __init__(self, location_set, sampler="opus_core.samplers.weighted_sampler", utilities="opus_core.linear_utilities", probabilities="opus_core.mnl_probabilities", choices="opus_core.random_choices", interaction_pkg="urbansim.datasets", filter=None, submodel_string=None, location_id_string=None, run_config=None, estimate_config=None, debuglevel=0, dataset_pool=None, **kwargs): """ Arguments: location_set - Dataset of locations to be chosen from. sampler - name of sampling module to be used for sampling locations. If it is None, no sampling is performed and all locations are considered for choice. utilities - name of utilities module probabilities - name of probabilities module choices - name of module for computing agent choices filter - filter is applied on location weights for sampling (by multiplication). It is either a string specifying an attribute name of the filter, or a 1D/2D array giving the filter directly, or a dictionary specifying filter for each submodel. If it is None, no filter is applied. submodel_string - character string specifying what agent attribute determines submodels. location_id_string - character string giving the fully qualified name of the agent attribute that specifies the location. Only needed when the attribute is a variable. Use it without the "as" clausel, since the code adds an alias which is the id name of the location set. run_config - collection of additional arguments that control a simulation run. It is of class Resources. estimate_config - collection of additional arguments that control an estimation run. It is of class Resources. debuglevel - debuglevel for the constructor. The level is overwritten by the argument in the run and estimate method. An instance of upc_sequence class with components utilities, probabilities and choices is created. Also an instance of Sampler class for given sampler procedure is created. """ self.dataset_pool = self.create_dataset_pool(dataset_pool, ["urbansim", "opus_core"]) ChoiceModel.__init__(self, choice_set=location_set, utilities=utilities, probabilities=probabilities, choices=choices, sampler=sampler, submodel_string=submodel_string, interaction_pkg=interaction_pkg, run_config=run_config, estimate_config=estimate_config, debuglevel=debuglevel, dataset_pool=dataset_pool, **kwargs) self.filter = filter self.location_id_string = location_id_string if self.location_id_string is not None: self.location_id_string = VariableName(self.location_id_string)
def __init__(self, choice_set, filter=None, choice_attribute_name='work_at_home', location_id_name='urbansim_parcel.person.building_id', match_number_of_jobs=False, **kwargs): """If match_number_of_jobs is True, the choices are drawn from the probability distribution in a way that the final number matches the number of jobs. """ self.job_set = choice_set self.filter = filter self.choice_attribute_name = choice_attribute_name self.location_id_name = location_id_name self.match_number_of_jobs=match_number_of_jobs ChoiceModel.__init__(self, [0, 1], choice_attribute_name=choice_attribute_name, **kwargs)
def __init__(self, choice_set, nested_structure=None, stratum=None, **kwargs): """'nested_structure' is a dictionary with keys being the nest identifiers and each value being a list of identifiers of the elemental alternatives belonging to that nest. 'stratum' is either a string giving the name of variable/expression determining the membership of choice's elements to nests. Or, it is an array of the size as choice set giving directly the membership of choice's elements to nests. Either 'nested_structure' or 'stratum' must be given. All arguments of the Choice Model can be used. """ ChoiceModel.__init__(self, choice_set, **kwargs) self.create_nested_and_tree_structure(nested_structure, stratum, **kwargs) self.set_model_interaction(**kwargs)
def __init__(self, choice_set, filter=None, choice_attribute_name='work_at_home', location_id_name='urbansim_parcel.person.building_id', **kwargs): self.job_set = choice_set self.filter = filter self.choice_attribute_name = choice_attribute_name self.location_id_name = location_id_name ChoiceModel.__init__(self, [0, 1], choice_attribute_name=choice_attribute_name, **kwargs)
def __init__(self, choice_set, utilities="opus_core.linear_utilities", probabilities="opus_core.mnl_probabilities", choices="opus_core.random_choices", interaction_pkg="biocomplexity.datasets", submodel_string="lct", choice_attribute_name="lct", run_config=None, estimate_config=None, debuglevel=0): self.choice_attribute_name = VariableName(choice_attribute_name) ChoiceModel.__init__(self, choice_set=choice_set, utilities=utilities, probabilities=probabilities, choices=choices, submodel_string=submodel_string, interaction_pkg=interaction_pkg, choice_attribute_name=self.choice_attribute_name.get_alias(), run_config=run_config, estimate_config=estimate_config, debuglevel=debuglevel)
def __init__(self, location_set, sampler="opus_core.samplers.weighted_sampler", utilities="opus_core.linear_utilities", probabilities="opus_core.mnl_probabilities", choices="opus_core.random_choices", interaction_pkg="urbansim.datasets", filter=None, submodel_string=None, location_id_string = None, run_config=None, estimate_config=None, debuglevel=0, dataset_pool=None, **kwargs): """ Arguments: location_set - Dataset of locations to be chosen from. sampler - name of sampling module to be used for sampling locations. If it is None, no sampling is performed and all locations are considered for choice. utilities - name of utilities module probabilities - name of probabilities module choices - name of module for computing agent choices filter - filter is applied on location weights for sampling (by multiplication). It is either a string specifying an attribute name of the filter, or a 1D/2D array giving the filter directly, or a dictionary specifying filter for each submodel. If it is None, no filter is applied. submodel_string - character string specifying what agent attribute determines submodels. location_id_string - character string giving the fully qualified name of the agent attribute that specifies the location. Only needed when the attribute is a variable. Use it without the "as" clausel, since the code adds an alias which is the id name of the location set. run_config - collection of additional arguments that control a simulation run. It is of class Resources. estimate_config - collection of additional arguments that control an estimation run. It is of class Resources. debuglevel - debuglevel for the constructor. The level is overwritten by the argument in the run and estimate method. An instance of upc_sequence class with components utilities, probabilities and choices is created. Also an instance of Sampler class for given sampler procedure is created. """ self.dataset_pool = self.create_dataset_pool(dataset_pool, ["urbansim", "opus_core"]) ChoiceModel.__init__(self, choice_set=location_set, utilities=utilities, probabilities=probabilities, choices=choices, sampler=sampler, submodel_string=submodel_string, interaction_pkg=interaction_pkg, run_config=run_config, estimate_config=estimate_config, debuglevel=debuglevel, dataset_pool=dataset_pool, **kwargs) self.filter = filter self.location_id_string = location_id_string if self.location_id_string is not None: self.location_id_string = VariableName(self.location_id_string)
def __init__(self, choice_set=[0,1], location_id_name="grid_id", movers_ratio=None, **kwargs): self.location_id_name = location_id_name self.movers_ratio = movers_ratio ChoiceModel.__init__(self, choice_set, **kwargs)