Mark,
In an Opus interaction variable, such as in any of the
household_x_gridcell variables, set of agents interact with a set of
locations (or members of other dataset). In your case, each household
has only one location (i.e. its gridcell), therefore it can be written
as a household variable. In the expression language, you could use:
'distance_to_cbd = household.disaggregate(gridcell.distance_to_cbd)'
If your version of Opus does not support the expression language,
you need to write a python module (in the household directory) that
would look similar to this:
from opus_core.variables.variable import Variable
class distance_to_cbd(Variable):
def dependencies(self):
return ['gridcell.distance_to_cbd', 'household.grid_id']
def compute(self, dataset_pool):
gridcells = dataset_pool.get_dataset('gridcell')
return self.get_dataset().get_join_data(gridcells,
name='distance_to_cbd')
Hana
Mark Kryvobokov wrote:
>
>
> Hana,
>
> Thank you. Yes, if the choice set doesn't include 0, it works.
>
> However, we would like to add some location (gridcells) attributes to
> the agents (households) attributes. In our AutoOwnershipChoiceModel we
> want to explain the number of cars not only with households attributes,
> but with e.g. distance to CBD. That's why we want to use
> household_x_gridcell variables.
>
> Is it possible in principle? We see that the HLCM uses
> household_x_gridcell variables, but there is location_set =
> Str('gridcell'), whereas in our case choice_set = ListInt([1,2,3])...
>
> Mark
>
> --- Original Message ---
> From: Hana Sevcikova <hana_at_cs.washington.edu>
> To: Mark Kryvobokov <k_mark_at_ukr.net>
> Date: 14 may, 23:31:27
> Subject: Re: [UrbanSim-Users] AutoOwnershipChoiceModel
>
> Mark,
>
> An interaction variable used in a choice model gives you a 2D array
> where one dimension is the number of agents, the other dimension
> corresponds to the number choices. I'm not sure, how do you want to use
> a household_x_gridcell variable in this context. Do you have a specific
> example?
>
> Your results of getting singular matrix might be due to the fact, that
> you're using a choice set that includes 0. The ChoiceModel doesn't like
> that (see http://www.urbansim.org/docs/opus-userguide/node130.html). In
> the newest developer version of urbansim you could specify an
> expression
> for choice_attribute_name, e.g. 'carsplus1 = household.cars + 1'. If
> you
> have an older version, you need to add an additional attribute to the
> household table that would shift the number of cars by a constant, so
> that you don't have a zero there.
>
> Hana
>
> Mark Kryvobokov wrote:
> >
> >
> > Hello,
> >
> > We are trying to create the Auto Ownership Choice Model. When we
> have
> > the independent variables from the 'household' dataset only, we
> obtain a
> > singular matrix. It seems that it's not enough to be limited to the
> > household attributes. We are trying to use the interaction variables
> > from the 'household_x_gridcell' dataset, but we get the error:
> >
> > "ValueError: different dataset names for variable and dataset or a
> > component".
> >
> > In the auto_ownership_choice_model_configuration_creator we
> specified:
> > agent_set = Str('household') and choice_attribute_name =
> Str('cars'),
> > where 'cars' is an attribute from the 'household' dataset. We
> also have
> > choice_set = ListInt([0,1,2]). So we get the interaction dataset
> > 'household_x_choice' and we seem to be limited to the variables
> that are
> > part of that dataset.
> >
> > Is it possible to use variables from 'household_x_gridcell' in
> this case
> > where there is already an interaction with another dataset which
> is choice?
> >
> > Thank you,
> >
> > Mark
> >
> >
> >
> >
> >
> >
> >
> ------------------------------------------------------------------------
>
> >
> > _______________________________________________
> > Users mailing list
> > Users_at_urbansim.org
> > http://www.urbansim.org/mailman/listinfo/users
>
Received on Mon May 19 2008 - 18:18:47 PDT
This archive was generated by hypermail 2.2.0 : Mon May 19 2008 - 18:18:49 PDT