@@ -195,14 +195,15 @@ def _empirical_log_logit_probs(lam: float, regrets: list) -> list:
195195 math .log (sum ([math .exp (lam * r ) for r in infoset ]))
196196 for infoset in regrets
197197 ]
198- return [lam * a - s for (r , s ) in zip (regrets , log_sums ) for a in r ]
198+ return [lam * a - s for (r , s ) in zip (regrets , log_sums , strict = True ) for a in r ]
199199
200200
201201def _empirical_log_like (lam : float , regrets : list , flattened_data : list ) -> float :
202202 """Given empirical choice regrets and a list of frequencies of choices, compute
203203 the log-likelihood of the choices given the regrets and assuming the logit
204204 choice model with lambda `lam`."""
205- return sum ([f * p for (f , p ) in zip (flattened_data , _empirical_log_logit_probs (lam , regrets ))])
205+ return sum ([f * p for (f , p ) in zip (flattened_data , _empirical_log_logit_probs (lam , regrets ),
206+ strict = True )])
206207
207208
208209def _estimate_strategy_empirical (
@@ -219,7 +220,8 @@ def _estimate_strategy_empirical(
219220 )
220221 profile = data .game .mixed_strategy_profile ()
221222 for strategy , log_prob in zip (data .game .strategies ,
222- _empirical_log_logit_probs (res .x [0 ], regrets )):
223+ _empirical_log_logit_probs (res .x [0 ], regrets ),
224+ strict = True ):
223225 profile [strategy ] = math .exp (log_prob )
224226 return LogitQREMixedStrategyFitResult (
225227 data , "empirical" , res .x [0 ], profile , - res .fun
@@ -239,7 +241,8 @@ def _estimate_behavior_empirical(
239241 bounds = ((0.0 , None ),)
240242 )
241243 profile = data .game .mixed_behavior_profile ()
242- for action , log_prob in zip (data .game .actions , _empirical_log_logit_probs (res .x [0 ], regrets )):
244+ for action , log_prob in zip (data .game .actions , _empirical_log_logit_probs (res .x [0 ], regrets ),
245+ strict = True ):
243246 profile [action ] = math .exp (log_prob )
244247 return LogitQREMixedBehaviorFitResult (
245248 data , "empirical" , res .x [0 ], profile , - res .fun
0 commit comments