Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
rakow committed Jul 26, 2024
1 parent fc2160c commit 1f1dd1a
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 27 deletions.
14 changes: 7 additions & 7 deletions input/v6.3/params/bg_plan_based_v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,24 @@ scoring:
constant: 0
- mode: car
constant: 0
dailyMonetaryConstant: -4.627
dailyMonetaryConstant: -5.1038273
- mode: pt
constant: -0.724590
constant: 0.065940
- mode: bike
constant: -1.590161
constant: -1.758609
- mode: ride
constant: -2.150079
constant: -2.194756
advancedScoring:
incomeExponent: 0.549347
scoringParameters:
- subpopulation: person
modeParams:
- mode: bike
deltaConstant: 1.284915
deltaConstant: 1.401864
varConstant: normal
- mode: pt
deltaConstant: 2.177996
deltaConstant: 2.061751
varConstant: normal
- mode: ride
deltaConstant: 1.565783
deltaConstant: 1.534127
varConstant: normal
29 changes: 15 additions & 14 deletions input/v6.3/params/bg_trip_based_v1.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
# + python -u estimate_biogeme_trip_choice.py --input trip-choices.csv --est-exp-income --est-performing
# + python -u estimate_biogeme_plan_choice.py --input plan-choices-diverse_9.csv --performing 7.547802 --exp-income 0.549347 --est-price-perception
# Modes: ['walk', 'pt', 'car', 'bike', 'ride']
# Number of choices: 27235
# Varying: ['km', 'hours', 'walking_km', 'switches', 'valid']
# Results for model trip_choice_performing_exp_income
# Number of plans: 8259
# Number of choices for plan: 9
# Number of choices: 8259
# Using MXL modes ['pt', 'bike', 'ride']
# Results for model plan-choices-diverse_9_price_perception
# Nbr of parameters: 9
# Sample size: 8238
# Observations: 27235
# Sample size: 8259
# Excluded data: 0
# Null log likelihood: -40155.25
# Final log likelihood: -22571.32
# Likelihood ratio test (null): 35167.85
# Rho square (null): 0.438
# Rho bar square (null): 0.438
# Akaike Information Criterion: 45160.65
# Bayesian Information Criterion: 45223.8
# Null log likelihood: -16584.31
# Final log likelihood: -16922.1
# Likelihood ratio test (null): -675.5779
# Rho square (null): -0.0204
# Rho bar square (null): -0.0209
# Akaike Information Criterion: 33862.19
# Bayesian Information Criterion: 33925.37
scoring:
scoringParameters:
- performing: 7.547802
Expand All @@ -22,7 +23,7 @@ scoring:
constant: 0
- mode: car
constant: 0
dailyMonetaryConstant: -4.627
dailyMonetaryConstant: -5.1038273
- mode: pt
constant: -2.554736
- mode: bike
Expand Down
4 changes: 2 additions & 2 deletions src/main/python/choicemodels/estimate_biogeme_plan_choice.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
UTIL_MONEY = Beta('UTIL_MONEY', 1, 0, 2, ESTIMATE if args.est_util_money else FIXED)

BETA_PERFORMING = Beta('BETA_PERFORMING', args.performing, 1, 15, ESTIMATE if args.est_performing else FIXED)
BETA_PRICE_PERCEPTION = Beta('BETA_FIXED_PRICE_PERCEPTION', 1, 0, 1, ESTIMATE if args.est_price_perception else FIXED)
BETA_PRICE_PERCEPTION = Beta('BETA_CAR_PRICE_PERCEPTION', 1, 0, 1, ESTIMATE if args.est_price_perception else FIXED)

is_est_car = "car" in args.mxl_modes

Expand Down Expand Up @@ -108,7 +108,7 @@
for i in range(1, ds.k + 1):
# Price is already negative

perceived_price = BETA_PRICE_PERCEPTION * v[f"plan_{i}_fixed_price"] + v[f"plan_{i}_distance_price"]
perceived_price = BETA_PRICE_PERCEPTION * v[f"plan_{i}_car_price"] + v[f"plan_{i}_non_car_price"]

u = perceived_price * UTIL_MONEY * (1 if args.no_income else (ds.global_income / v["income"]) ** EXP_INCOME)
u -= v[f"plan_{i}_pt_n_switches"]
Expand Down
13 changes: 9 additions & 4 deletions src/main/python/choicemodels/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ def calc_plan_variables(df, k, modes, use_util_money=False, add_util_performing=

# Price is only monetary costs
df[f"plan_{i}_price"] = 0
df[f"plan_{i}_fixed_price"] = 0
df[f"plan_{i}_distance_price"] = 0
df[f"plan_{i}_car_price"] = 0
df[f"plan_{i}_non_car_price"] = 0

# Costs will also include time costs
df[f"plan_{i}_utils"] = 0
Expand All @@ -98,8 +98,13 @@ def calc_plan_variables(df, k, modes, use_util_money=False, add_util_performing=

df[f"plan_{i}_{mode}_fixed_cost"] = fixed_costs
df[f"plan_{i}_price"] += fixed_costs + distance_costs
df[f"plan_{i}_fixed_price"] += fixed_costs
df[f"plan_{i}_distance_price"] += distance_costs

if mode == "car":
df[f"plan_{i}_car_price"] += fixed_costs
else:
df[f"plan_{i}_non_car_price"] += fixed_costs

df[f"plan_{i}_non_car_price"] += distance_costs

df[f"plan_{i}_{mode}_used"] = (df[f"plan_{i}_{mode}_usage"] > 0) * 1
df[f"plan_{i}_tt_hours"] -= df[f"plan_{i}_{mode}_hours"]
Expand Down

0 comments on commit 1f1dd1a

Please sign in to comment.