Skip to content

Commit

Permalink
tests of mnl_estimate compared to R's mlogit
Browse files Browse the repository at this point in the history
  • Loading branch information
jiffyclub committed Nov 21, 2014
1 parent d5f9c82 commit e4ed2a4
Show file tree
Hide file tree
Showing 6 changed files with 5,698 additions and 2 deletions.
6 changes: 4 additions & 2 deletions urbansim/urbanchoice/mnl.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
``urbansim.models.lcm``.
"""
from __future__ import print_function

import logging

import numpy as np
Expand Down Expand Up @@ -190,15 +192,15 @@ def mnl_estimate(data, chosen, numalts, GPU=False, coeffrange=(-3, 3),

if beta is None:
beta = np.zeros(numvars)
bounds = np.array([coeffrange for i in range(numvars)])
bounds = [coeffrange] * numvars

with log_start_finish('scipy optimization for MNL fit', logger):
args = (data, chosen, numalts, weights, lcgrad)
bfgs_result = scipy.optimize.fmin_l_bfgs_b(mnl_loglik,
beta,
args=args,
fprime=None,
factr=1e5,
factr=10,
approx_grad=False,
bounds=bounds
)
Expand Down
Empty file.
Loading

0 comments on commit e4ed2a4

Please sign in to comment.