Biogeme: Python Library
2.5
|
Class extracting an expression from a dictionary. More...
Public Member Functions | |
def | __init__ (self, dictionary, key, default=Numeric(0)) |
def | getExpression (self) |
def | getID (self) |
Public Member Functions inherited from bio_expression.Expression | |
def | __init__ (self) |
Constructor. | |
def | getExpression (self) |
def | getID (self) |
def | __str__ (self) |
def | __neg__ (self) |
def | __add__ (self, expression) |
def | __radd__ (self, expression) |
def | __sub__ (self, expression) |
def | __rsub__ (self, expression) |
def | __mul__ (self, expression) |
def | __rmul__ (self, expression) |
def | __div__ (self, expression) |
def | __rdiv__ (self, expression) |
def | __truediv__ (self, expression) |
Support for Python version 3.x. More... | |
def | __rtruediv__ (self, expression) |
Support for Python version 3.x. More... | |
def | __mod__ (self, expression) |
def | __pow__ (self, expression) |
def | __rpow__ (self, expression) |
def | __and__ (self, expression) |
def | __or__ (self, expression) |
def | __eq__ (self, expression) |
def | __ne__ (self, expression) |
def | __le__ (self, expression) |
def | __ge__ (self, expression) |
def | __lt__ (self, expression) |
def | __gt__ (self, expression) |
Public Attributes | |
prob | |
choice | |
default | |
operatorIndex | |
Public Attributes inherited from bio_expression.Expression | |
operatorIndex | |
Class extracting an expression from a dictionary.
A typical example consists in returning the probability of a chosen alternative in a choice model. Consider the following dictionary:
and assume that the variable Choice in the data file contains the identifier of the chosen alternative of the corresponding observation, that is 1, 2 or 3. Then, the probability of the chosen alternative is given by
If the result of "Choice" does not correspond to any valid entry in the dictionary, a warning is issued and the value of the default expression is returned. The warning is issued because this situation is usually not wanted by the user. To turn off the warning, set the parameter warnsForIllegalElements to 0.
Definition at line 871 of file bio_expression.py.
def bio_expression.Elem.__init__ | ( | self, | |
dictionary, | |||
key, | |||
default = Numeric(0) |
|||
) |
dictionary | A dictionary (see Python documentation) such that the indices are numerical values that can match the result of an expression |
key | expression identifying the entry in the dictionary If the result of key does not correspond to any valid entry in the dictionary, the value of the default expression is returned. This argument is optional. If omitted, the default value is 0. |
Definition at line 880 of file bio_expression.py.