Total number of possible specifications: None

73 views
Skip to first unread message

Atefeh Fakourrad

unread,
May 8, 2023, 11:50:52 AM5/8/23
to Biogeme
Dear Prof. Bierlaire,

When I run the example code regarding the estimation of several versions of the model using assisted specification algorithm (https://github.com/michelbierlaire/biogeme/blob/master/examples/swissmetro/b21multiple_models_spec.py), I receive the following message and no possible specification is shown. 

Total number of possible specifications: None

Would you please let me know why this is shown? 

Best, 
Ati. 





Bierlaire Michel

unread,
May 8, 2023, 11:51:41 AM5/8/23
to a.fak...@gmail.com, Bierlaire Michel, Biogeme
Did you upgrade your version of Biogeme to 3.2.11?
> --
> You received this message because you are subscribed to the Google Groups "Biogeme" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to biogeme+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/biogeme/b25e3e3e-0a71-4463-b7cf-7c4b3121adcbn%40googlegroups.com.

Michel Bierlaire
Transport and Mobility Laboratory
School of Architecture, Civil and Environmental Engineering
EPFL - Ecole Polytechnique Fédérale de Lausanne
http://transp-or.epfl.ch
http://people.epfl.ch/michel.bierlaire

Atefeh Fakourrad

unread,
May 9, 2023, 3:08:03 AM5/9/23
to Biogeme
Yes the version of Biogeme is 3.2.11 and here is the output: 

WARNING:biogeme.toml:File biogeme.toml has been created
Total number of possible specifications: None

I have even printed output of the logprob:
_bioLogLogit[choice=CHOICE]U=(1:(([segmented_ASC_TRAIN: ASC_TRAIN (no seg.)]bioMultSum(ASC_TRAIN(init=0)) + (B_TIME(init=0) * [TRAIN_TT: linear]TRAIN_TT_SCALED)) + ([segmented_B_COST: B_COST (no seg.)]bioMultSum(B_COST(init=0)) * TRAIN_COST_SCALED)), 2:((B_TIME(init=0) * [SM_TT: linear]SM_TT_SCALED) + ([segmented_B_COST: B_COST (no seg.)]bioMultSum(B_COST(init=0)) * SM_COST_SCALED)), 3:(([segmented_ASC_CAR: ASC_CAR (no seg.)]bioMultSum(ASC_CAR(init=0)) + (B_TIME(init=0) * [CAR_TT: linear]CAR_TT_SCALED)) + ([segmented_B_COST: B_COST (no seg.)]bioMultSum(B_COST(init=0)) * CAR_CO_SCALED)))av=(1:TRAIN_AV_SP, 2:SM_AV, 3:CAR_AV_SP)

Is there any other reason that no possible specifications are shown?Best,Ati.  

Bierlaire Michel

unread,
May 9, 2023, 3:12:17 AM5/9/23
to a.fak...@gmail.com, Bierlaire Michel, Biogeme
Here is the output that I obtain:

Total number of possible specifications: None
File biogeme.toml has been created
Example b21multipleModels
Pareto set initialized from file with 9 elements [5 Pareto].
Pareto set initialized from file with 9 elements [5 Pareto].
Algorithm info:
Initial Pareto: 5
Initial considered: 9
Final Pareto: 5
Condidered: 9
Removed: 0
The number of possible specifications exceeds the maximum number [100]. A heuristic algorithm is applied.
TRAIN_TT:linear;segmented_ASC_CAR:ASC_CAR (no seg.);segmented_B_COST:B_COST (no seg.) [5331.252006916163, 4.0]
Initial pareto: 5
Attempt 1/100
Iteration 1/20 for current solution
Iteration 2/20 for current solution
Iteration 3/20 for current solution
Iteration 4/20 for current solution
Iteration 5/20 for current solution
Iteration 6/20 for current solution
Iteration 7/20 for current solution
Iteration 8/20 for current solution
Iteration 9/20 for current solution
Parameters read from biogeme.toml
*** Estimate b21multiple_models_000000
Optimization algorithm: hybrid Newton/BFGS with simple bounds [simple_bounds]
** Optimization: Newton with trust region for simple bounds
Proportion of Hessian calculation: 100.0%
Iteration 10/20 for current solution
Iteration 11/20 for current solution
Iteration 12/20 for current solution
Iteration 13/20 for current solution
Iteration 14/20 for current solution
Iteration 15/20 for current solution
Iteration 16/20 for current solution
Iteration 17/20 for current solution
Iteration 18/20 for current solution
Iteration 19/20 for current solution
Iteration 20/20 for current solution
Attempt 2/100
Iteration 1/20 for current solution
Parameters read from biogeme.toml


> On 9 May 2023, at 08:53, Atefeh Fakourrad <a.fak...@gmail.com> wrote:
>
> Yes the version of Biogeme is 3.2.11 and here is the output:
>
> WARNING:biogeme.toml:File biogeme.toml has been created
> Total number of possible specifications: None
>
> I have even printed output of the logprob:
> _bioLogLogit[choice=CHOICE]U=(1:(([segmented_ASC_TRAIN: ASC_TRAIN (no seg.)]bioMultSum(ASC_TRAIN(init=0)) + (B_TIME(init=0) * [TRAIN_TT: linear]TRAIN_TT_SCALED)) + ([segmented_B_COST: B_COST (no seg.)]bioMultSum(B_COST(init=0)) * TRAIN_COST_SCALED)), 2:((B_TIME(init=0) * [SM_TT: linear]SM_TT_SCALED) + ([segmented_B_COST: B_COST (no seg.)]bioMultSum(B_COST(init=0)) * SM_COST_SCALED)), 3:(([segmented_ASC_CAR: ASC_CAR (no seg.)]bioMultSum(ASC_CAR(init=0)) + (B_TIME(init=0) * [CAR_TT: linear]CAR_TT_SCALED)) + ([segmented_B_COST: B_COST (no seg.)]bioMultSum(B_COST(init=0)) * CAR_CO_SCALED)))av=(1:TRAIN_AV_SP, 2:SM_AV, 3:CAR_AV_SP)
> Is there any other reason that no possible specifications are shown?Best,Ati.
>
> On Monday, May 8, 2023 at 5:51:41 PM UTC+2 michel.b...@epfl.ch wrote:
> Did you upgrade your version of Biogeme to 3.2.11?
>
>
> > On 8 May 2023, at 17:21, Atefeh Fakourrad <a.fak...@gmail.com> wrote:
> >
> > Dear Prof. Bierlaire,
> >
> > When I run the example code regarding the estimation of several versions of the model using assisted specification algorithm (https://github.com/michelbierlaire/biogeme/blob/master/examples/swissmetro/b21multiple_models_spec.py), I receive the following message and no possible specification is shown.
> >
> > Total number of possible specifications: None
> >
> > Would you please let me know why this is shown?
> >
> > Best,
> > Ati.
> >
> >
> >
> >
> >
> >
> > --
> > You received this message because you are subscribed to the Google Groups "Biogeme" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to biogeme+u...@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/biogeme/b25e3e3e-0a71-4463-b7cf-7c4b3121adcbn%40googlegroups.com.
>
> Michel Bierlaire
> Transport and Mobility Laboratory
> School of Architecture, Civil and Environmental Engineering
> EPFL - Ecole Polytechnique Fédérale de Lausanne
> http://transp-or.epfl.ch
> http://people.epfl.ch/michel.bierlaire
>
>
> --
> You received this message because you are subscribed to the Google Groups "Biogeme" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to biogeme+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/biogeme/ee90c3c7-a573-44ba-8ff7-3eb28022e2f2n%40googlegroups.com.

Atefeh Fakourrad

unread,
May 9, 2023, 4:34:41 AM5/9/23
to Biogeme
Thank you for your reply. I have tried it with several computers but I did not get the same output that you just shared. I wonder if your syntax exactly matches the following or if there are some differences, especially at the end of the code?

import biogeme.biogeme as bio
from biogeme import models
from biogeme.expressions import Beta, logzero
from biogeme.catalog import Catalog, SynchronizedCatalog, segmentation_catalog
from biogeme.segmentation import DiscreteSegmentationTuple


# Parameters to be estimated
ASC_CAR = Beta('ASC_CAR', 0, None, None, 0)
ASC_TRAIN = Beta('ASC_TRAIN', 0, None, None, 0)
B_TIME = Beta('B_TIME', 0, None, None, 0)
B_COST = Beta('B_COST', 0, None, None, 0)

# Segmentations
gender_segmentation = DiscreteSegmentationTuple(
variable=MALE,
mapping={
0: 'female',
1: 'male',
},
)

income_segmentation = DiscreteSegmentationTuple(
variable=INCOME,
mapping={
1: 'inc-under50',
2: 'inc-50-100',
3: 'inc-100+',
4: 'inc-unknown',
},
)

ga_segmentation = DiscreteSegmentationTuple(variable=GA, mapping={1: 'GA', 0: 'noGA'})

asc_segmentations = (
gender_segmentation,
ga_segmentation,
)
ASC_CAR_catalog = segmentation_catalog(
beta_parameter=ASC_CAR,
potential_segmentations=asc_segmentations,
maximum_number=2,
)
ASC_TRAIN_catalog = segmentation_catalog(
beta_parameter=ASC_TRAIN,
potential_segmentations=asc_segmentations,
maximum_number=2,
synchronized_with=ASC_CAR_catalog,
)

cost_segmentations = (
ga_segmentation,
income_segmentation,
)
B_COST_catalog = segmentation_catalog(
beta_parameter=B_COST,
potential_segmentations=cost_segmentations,
maximum_number=1,
)

ell_time = Beta('lambda_time', 1, None, None, 0)
# Potential non linear specification of travel time
TRAIN_TT_catalog = Catalog.from_dict(
catalog_name='TRAIN_TT',
dict_of_expressions={
'linear': TRAIN_TT_SCALED,
'log': logzero(TRAIN_TT_SCALED),
'boxcox': models.boxcox(TRAIN_TT_SCALED, ell_time),
},
)

SM_TT_catalog = SynchronizedCatalog.from_dict(
catalog_name='SM_TT',
dict_of_expressions={
'linear': SM_TT_SCALED,
'log': logzero(SM_TT_SCALED),
'boxcox': models.boxcox(SM_TT_SCALED, ell_time),
},
controller=TRAIN_TT_catalog,
)

CAR_TT_catalog = SynchronizedCatalog.from_dict(
catalog_name='CAR_TT',
dict_of_expressions={
'linear': CAR_TT_SCALED,
'log': logzero(CAR_TT_SCALED),
'boxcox': models.boxcox(CAR_TT_SCALED, ell_time),
},
controller=TRAIN_TT_catalog,
)

# Definition of the utility functions with linear cost
V1 = ASC_TRAIN_catalog + B_TIME * TRAIN_TT_catalog + B_COST_catalog * TRAIN_COST_SCALED
V2 = B_TIME * SM_TT_catalog + B_COST_catalog * SM_COST_SCALED
V3 = ASC_CAR_catalog + B_TIME * CAR_TT_catalog + B_COST_catalog * CAR_CO_SCALED

# Associate utility functions with the numbering of alternatives
V = {1: V1, 2: V2, 3: V3}

# Associate the availability conditions with the alternatives
av = {1: TRAIN_AV_SP, 2: SM_AV, 3: CAR_AV_SP}

# Definition of the model. This is the contribution of each
# observation to the log likelihood function.
logprob = models.loglogit(V, av, CHOICE)

print(
f'Total number of possible specifications: '
f'{logprob.number_of_multiple_expressions()}\n'
f'{logprob}'
)

the_biogeme = bio.BIOGEME(database, logprob)
the_biogeme.modelName = 'b21multiple_models'

PARETO_FILE_NAME = 'b21multiple_models.pareto'

 

Mat Guy

unread,
May 10, 2023, 5:30:34 PM5/10/23
to Biogeme
Dear Prof. Bierlare,
I have the same problem, the output is:

Total number of possible specifications: None

Best regards,
M. Guyon

Bierlaire Michel

unread,
May 11, 2023, 3:32:44 AM5/11/23
to math...@orange.fr, Bierlaire Michel, Biogeme
You need to run the script
b21multiple_models.py
not the script
b21multiple_models_spec.py

Indeed, the latter does not do anything, It simply defines the specification, and is imported in the former.
> To view this discussion on the web visit https://groups.google.com/d/msgid/biogeme/631f08d2-9e14-46da-85f1-9f9df207be80n%40googlegroups.com.

Mat Guy

unread,
May 11, 2023, 4:29:34 AM5/11/23
to Biogeme
Dear Prof. Bierlare,

Ok, thank you!
It works now.

Best regards,
M. Guyon

Reply all
Reply to author
Forward
0 new messages