Biogeme 3.2.14 - piecewise_variables raises when expression is not of type Variable
20 views
Skip to first unread message
Luca Bataillard
unread,
Nov 18, 2024, 3:48:16 AM11/18/24
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Biogeme
Hello everyone,
I was completing this notebook from the Selected topics on Discrete Choice MOOC and ran into an issue with the models.piecewise_variables function crashing. Since theTRAIN_COST_SCALED variable is a composite Expression (runtime type of Division), it is not of type Variable and fails the check on line 75 of models/piecewise.py and raises an exception.
However, this notebook worked and produced correct results in version 3.2.13, and also works if we change the line in 3.2.14's models/piecewise.py from:
ifnot isinstance(variable, Variable):
to
ifnot isinstance(variable, Expression):
I can't find any information on this in the docs, is it intentional? If so, how can we solve the problem in the notebook and can we improve the type hints for this function?
Thanks,
Luca
Michel Bierlaire
unread,
Nov 19, 2024, 3:13:49 AM11/19/24
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to luca.ba...@gmail.com, Michel Bierlaire, Biogeme