Public Member Functions | Public Attributes

bio_expression::Elem Class Reference

Class extracting an expression from a dictionary. More...

Inheritance diagram for bio_expression::Elem:
bio_expression::Expression

List of all members.

Public Member Functions

def __init__
def getExpression

Public Attributes

 prob
 choice
 default
 operatorIndex

Detailed Description

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:

 P = {  1: exp(V1) / (exp(V1)+exp(V2)+exp(V3)),
 2: exp(V2) / (exp(V1)+exp(V2)+exp(V3)),
 3: exp(V3) / (exp(V1)+exp(V2)+exp(V3))}

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

 chosenProba = Elem(P,Choice)

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.


Constructor & Destructor Documentation

def bio_expression::Elem::__init__ (   self,
  dictionary,
  key,
  default = Numeric(0) 
)
Parameters:
dictionaryA dictionary (see Python documentation) such that the indices are numerical values that can match the result of an expression
keyexpression 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.

Member Function Documentation

def bio_expression::Elem::getExpression (   self )
Returns:
Return the string representation of the current expression

Reimplemented from bio_expression::Expression.


Member Data Documentation

Reimplemented from bio_expression::Expression.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables