biogeme巢式logit选择学习
1|0导入库
1|1输入选择集
{'Unnamed: 0.2': Unnamed: 0.2,
'Unnamed: 0.1': Unnamed: 0.1,
'Unnamed: 0': Unnamed: 0,
'id': id,
'hc_time_all': hc_time_all,
'hc_cishu': hc_cishu,
'hc_fare': hc_fare,
'path_length': path_length,
'car_fare': car_fare,
'car_time': car_time,
'car_cishu': car_cishu,
'bus_time': bus_time,
'metro_fare': metro_fare,
'metro_cishu': metro_cishu,
'metro_time': metro_time,
'bus_fare': bus_fare,
'bus_cishu': bus_cishu,
'choice': choice}
1|2定义变量
1|3定义效用函数
1|4效用对应方案
1|5定义树形结构
1|6计算logprob
1|7估计参数
[16:12:00] < Warning > Numerical problem with the second derivative matrix. Norm = inf. Replaced by the identity matrix.
[16:12:01] < Warning > Numerical problem with the second derivative matrix. Norm = inf. Replaced by the identity matrix.
[16:12:01] < Warning > Numerical problem with the second derivative matrix. Norm = inf. Replaced by the identity matrix.
[16:12:02] < Warning > Numerical problem with the second derivative matrix. Norm = inf. Replaced by the identity matrix.
[16:12:03] < Warning > Numerical problem with the second derivative matrix. Norm = inf. Replaced by the identity matrix.
[16:12:04] < Warning > Numerical problem with the second derivative matrix. Norm = inf. Replaced by the identity matrix.
[16:12:06] < Warning > Numerical problem with the second derivative matrix. Norm = inf. Replaced by the identity matrix.
[16:12:10] < Warning > Numerical problem with the second derivative matrix. Norm = inf. Replaced by the identity matrix.
[16:12:12] < Warning > Numerical problem with the second derivative matrix. Norm = inf. Replaced by the identity matrix.
[16:12:15] < Warning > Numerical problem with the second derivative matrix. Norm = inf. Replaced by the identity matrix.
[16:12:17] < Warning > Numerical problem with the second derivative matrix. Norm = inf. Replaced by the identity matrix.
[16:12:18] < Warning > Numerical problem with the second derivative matrix. Norm = inf. Replaced by the identity matrix.
[16:12:20] < Warning > Numerical problem with the second derivative matrix. Norm = inf. Replaced by the identity matrix.
[16:12:23] < Warning > Numerical problem with the second derivative matrix. Norm = inf. Replaced by the identity matrix.
[16:12:24] < Warning > Numerical problem with the second derivative matrix. Norm = inf. Replaced by the identity matrix.
[16:12:25] < Warning > Numerical problem with the second derivative matrix. Norm = inf. Replaced by the identity matrix.
[16:12:26] < Warning > Numerical problem with the second derivative matrix. Norm = inf. Replaced by the identity matrix.
[16:12:27] < Warning > Numerical problem with the second derivative matrix. Norm = inf. Replaced by the identity matrix.
[16:12:28] < Warning > Numerical problem with the second derivative matrix. Norm = inf. Replaced by the identity matrix.
[16:12:29] < Warning > Numerical problem with the second derivative matrix. Norm = inf. Replaced by the identity matrix.
[16:12:30] < Warning > Numerical problem with the second derivative matrix. Norm = inf. Replaced by the identity matrix.
[16:12:31] < Warning > Numerical problem with the second derivative matrix. Norm = inf. Replaced by the identity matrix.
[16:12:31] < Warning > Numerical problem with the second derivative matrix. Norm = inf. Replaced by the identity matrix.
[16:12:32] < Warning > Numerical problem with the second derivative matrix. Norm = inf. Replaced by the identity matrix.
[16:12:33] < Warning > Numerical problem with the second derivative matrix. Norm = inf. Replaced by the identity matrix.
Value Rob. Std err Rob. t-test Rob. p-value
ASC_BUS -7.965898e-01 0.0 1.797693e+308 0.0
ASC_CAR -1.250052e+00 0.0 1.797693e+308 0.0
ASC_HC 9.795643e-01 0.0 1.797693e+308 0.0
ASC_METRO 1.067077e+00 0.0 1.797693e+308 0.0
BETA_CISHU_BUS -1.776695e+00 0.0 1.797693e+308 0.0
BETA_CISHU_METRO -6.685987e-03 0.0 1.797693e+308 0.0
BETA_FARE_BUS 8.880739e-01 0.0 1.797693e+308 0.0
BETA_FARE_CAR 2.888911e-07 0.0 1.797693e+308 0.0
BETA_FARE_HC 3.266817e-04 0.0 1.797693e+308 0.0
BETA_FARE_METRO -3.187853e-02 0.0 1.797693e+308 0.0
BETA_LENGTH 1.094267e-04 0.0 1.797693e+308 0.0
BETA_TIME_BUS -8.687563e-07 0.0 1.797693e+308 0.0
BETA_TIME_CAR -8.526598e-04 0.0 1.797693e+308 0.0
BETA_TIME_HC 4.400077e-06 0.0 1.797693e+308 0.0
BETA_TIME_METRO -3.083993e-07 0.0 1.797693e+308 0.0
PUBLIC 6.521609e+02 0.0 1.797693e+308 0.0
1|8获取每个备选方案的选择概率
1|9读取估计结果
1|10进行模拟,计算选择概率和效用值
Utility CAR | Utility BUS | Utility METRO | Utility HC | Prob. CAR | Prob. BUS | Prob. METRO | Prob. HC | |
---|---|---|---|---|---|---|---|---|
0 | -1.934563 | 1.258228 | 1.318423 | 1.282484 | 0.037193 | 0.006809 | 0.907109 | 0.048888 |
1 | -1.934563 | 1.258228 | 1.318434 | 1.282424 | 0.037193 | 0.006805 | 0.907380 | 0.048621 |
2 | -1.934563 | 1.274554 | 1.306116 | 1.282484 | 0.037573 | 0.060507 | 0.786654 | 0.115265 |
3 | -1.934563 | 1.274554 | 1.306116 | 1.282424 | 0.037574 | 0.060543 | 0.787116 | 0.114767 |
4 | -1.934563 | 1.274554 | 1.306092 | 1.282484 | 0.037574 | 0.060606 | 0.786367 | 0.115453 |
... | ... | ... | ... | ... | ... | ... | ... | ... |
2425 | -1.909643 | 1.258093 | 1.309319 | 1.289848 | 0.038368 | 0.012255 | 0.787545 | 0.161833 |
2426 | -1.909643 | 1.257291 | 1.308803 | 1.289848 | 0.038384 | 0.011891 | 0.782124 | 0.167601 |
2427 | -1.909643 | 1.274355 | 1.309319 | 1.289848 | 0.038352 | 0.044393 | 0.760898 | 0.156357 |
2428 | -1.909643 | 1.266182 | 1.308803 | 1.289848 | 0.038378 | 0.024174 | 0.772013 | 0.165435 |
2429 | -1.909643 | 1.266453 | 1.309319 | 1.289848 | 0.038362 | 0.023878 | 0.777908 | 0.159852 |
2430 rows × 8 columns
1|11另一种模拟方法,加入biogeme
模拟结果相同,但速度更快
Utility CAR | Utility BUS | Utility METRO | Utility HC | Prob. CAR | Prob. BUS | Prob. METRO | Prob. HC | |
---|---|---|---|---|---|---|---|---|
0 | -1.934563 | 1.258228 | 1.318423 | 1.282484 | 0.037193 | 0.006809 | 0.907109 | 0.048888 |
1 | -1.934563 | 1.258228 | 1.318434 | 1.282424 | 0.037193 | 0.006805 | 0.907380 | 0.048621 |
2 | -1.934563 | 1.274554 | 1.306116 | 1.282484 | 0.037573 | 0.060507 | 0.786654 | 0.115265 |
3 | -1.934563 | 1.274554 | 1.306116 | 1.282424 | 0.037574 | 0.060543 | 0.787116 | 0.114767 |
4 | -1.934563 | 1.274554 | 1.306092 | 1.282484 | 0.037574 | 0.060606 | 0.786367 | 0.115453 |
... | ... | ... | ... | ... | ... | ... | ... | ... |
2425 | -1.909643 | 1.258093 | 1.309319 | 1.289848 | 0.038368 | 0.012255 | 0.787545 | 0.161833 |
2426 | -1.909643 | 1.257291 | 1.308803 | 1.289848 | 0.038384 | 0.011891 | 0.782124 | 0.167601 |
2427 | -1.909643 | 1.274355 | 1.309319 | 1.289848 | 0.038352 | 0.044393 | 0.760898 | 0.156357 |
2428 | -1.909643 | 1.266182 | 1.308803 | 1.289848 | 0.038378 | 0.024174 | 0.772013 | 0.165435 |
2429 | -1.909643 | 1.266453 | 1.309319 | 1.289848 | 0.038362 | 0.023878 | 0.777908 | 0.159852 |
2430 rows × 8 columns
__EOF__

本文链接:https://www.cnblogs.com/quanbb0818/p/16848829.html
关于博主:评论和私信会在第一时间回复。或者直接私信我。
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
声援博主:如果您觉得文章对您有帮助,可以点击文章右下角【推荐】一下。您的鼓励是博主的最大动力!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)