Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions choicemodels/mnl.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ def mnl_loglik(beta, data, chosen, numalts, weights=None, lcgrad=False,
return -1 * loglik, -1 * gradarr


def mnl_estimate(data, chosen, numalts, GPU=False, coeffrange=(-1000, 1000),
def mnl_estimate(data, chosen, numalts, GPU=False, coeffrange=(None, None),
weights=None, lcgrad=False, beta=None):
"""
Calculate coefficients of the MNL model.
Expand Down Expand Up @@ -689,7 +689,7 @@ def mnl_estimate(data, chosen, numalts, GPU=False, coeffrange=(-1000, 1000),
beta,
args=args,
fprime=None,
factr=10,
factr=10e9,
approx_grad=False,
bounds=bounds)
logger.debug('finish: scipy optimization for MNL fit')
Expand All @@ -715,6 +715,7 @@ def mnl_estimate(data, chosen, numalts, GPU=False, coeffrange=(-1000, 1000),
aic = -2 * ll + 2 * len(beta)

log_likelihood = {
"model_converged": bfgs_result[2]['warnflag'] == 0,
'null': float(l0[0][0]),
'convergence': float(l1[0][0]),
'ratio': float((1 - (l1 / l0))[0][0]),
Expand Down
2 changes: 1 addition & 1 deletion choicemodels/tools/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def iterative_lottery_choices(
capacity, size = (alt_capacity, chooser_size)

len_choosers = len(choosers)
valid_choices = pd.Series()
valid_choices = pd.Series(dtype='float64')
iter = 0

while (len(valid_choices) < len_choosers):
Expand Down