runn.econometric_indicators
Useful econometric indicators that can be extracted from the models.
market_shares(model, x)
#
Calculate the market shares for each alternative.
PARAMETER | DESCRIPTION |
---|---|
model |
The model to be used. It should be a model defined in the runn.models module.
TYPE:
|
x |
The input data. It can be a tf.Tensor, np.ndarray or pd.DataFrame.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
ndarray
|
Numpy array with the market shares for each alternative. |
Source code in runn/econometric_indicators.py
value_of_time(model, x, time_attribute, cost_attribute, alt, scaler=None)
#
Calculate the value of time (VOT) for a given alternative. The VOT is calculated for all the observations in the input data.
PARAMETER | DESCRIPTION |
---|---|
model |
The model to be used. It should be a model defined in the runn.models module.
TYPE:
|
x |
The input data. It can be a tf.Tensor, np.ndarray or pd.DataFrame.
TYPE:
|
time_attribute |
The index or name of the time attribute. |
cost_attribute |
The index or name of the cost attribute. |
alt |
The index of the alternative to be analysed.
TYPE:
|
scaler |
If the data was scaled before training the model, the scaler object should be provided. Currently, only the StandardScaler and MinMaxScaler from sklearn.preprocessing are supported. Default: None. |
RETURNS | DESCRIPTION |
---|---|
ndarray
|
Numpy array with the VOT for each observation in the input data. |
Source code in runn/econometric_indicators.py
willingness_to_pay(model, x, analysed_attribute, cost_attribute, alt, scaler=None)
#
Calculate the willingness to pay (WTP) for a given attribute and alternative. The WTP is calculated for all the observations in the input data.
PARAMETER | DESCRIPTION |
---|---|
model |
The model to be used. It should be a model defined in the runn.models module.
TYPE:
|
x |
The input data. It can be a tf.Tensor, np.ndarray or pd.DataFrame.
TYPE:
|
analysed_attribute |
The index or name of the attribute to be analysed. |
cost_attribute |
The index or name of the cost attribute. |
alt |
The index of the alternative to be analysed.
TYPE:
|
scaler |
If the data was scaled before training the model, the scaler object should be provided. Currently, only the StandardScaler and MinMaxScaler from sklearn.preprocessing are supported. Default: None. |
RETURNS | DESCRIPTION |
---|---|
ndarray
|
Numpy array with the WTP for each observation in the input data. |
Source code in runn/econometric_indicators.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
|