Skip to content

Commit

Permalink
Merge branch 'master' into doc-cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
smmaurer committed Feb 7, 2019
2 parents 759e14c + b43571f commit 82386b3
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 12 deletions.
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@ python:

matrix:
include:
- python: '3.7' # temp solution until python 3.7 is more cleanly supported
- python: "3.7" # temp solution until travis supports python 3.7 more cleanly
dist: xenial
sudo: true
allow_failures:
- python: '3.7' # dependencies are blocking installation
fast_finish: true

install:
- pip install .
- pip install -r requirements-dev.txt
- # extra tests run if urbansim is present, but it can't install with python 3.7
- if [ "$TRAVIS_PYTHON_VERSION" != "3.7" ]; then pip install urbansim; fi
- pip list
- pip show choicemodels

Expand Down
1 change: 0 additions & 1 deletion docs/build/.gitignore

This file was deleted.

4 changes: 2 additions & 2 deletions docs/source/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ ChoiceModels was created in 2016, with contributions from Sam Maurer (maurer@urb
Installation
------------

ChoiceModels is tested with Python 2.7, 3.5, and 3.6. It should work with Python 3.7 as well, but you won't be able to intall some related UDST libraries like UrbanSim and Orca.
ChoiceModels is tested with Python 2.7, 3.5, 3.6, and 3.7. It should run on any platform.


Production releases
~~~~~~~~~~~~~~~~~~~

ChoiceModels can be installed using the Pip or Conda package managers.
ChoiceModels can be installed using the Pip or Conda package managers. We recommend Conda because it resolves dependency conflicts better.

.. code-block:: python
Expand Down
4 changes: 3 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# requirements for development and testing

coverage >= 4.5
coveralls >= 1.3
pytest >= 3.4
urbansim >= 3.1
# urbansim >= 3.1 # additional tests will run if urbansim is installed
sphinx
sphinx_rtd_theme
16 changes: 14 additions & 2 deletions tests/test_mnl_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

from pandas.testing import assert_frame_equal
from patsy import dmatrix
from urbansim.urbanchoice.mnl import mnl_estimate, mnl_simulate

from choicemodels import MultinomialLogit
from choicemodels.tools import MergedChoiceTable
Expand Down Expand Up @@ -43,9 +42,15 @@ def test_mnl(obs, alts):
def test_mnl_estimation(obs, alts):
"""
Confirm that estimated params from the new interface match urbansim.urbanchoice.
Only runs if the urbansim package has been installed.
"""

try:
from urbansim.urbanchoice.mnl import mnl_estimate
except:
print("Comparison of MNL estimation results skipped because urbansim is not installed")
return

model_expression = 'obsval + altval - 1'
mct = MergedChoiceTable(obs, alts, 'choice')

Expand All @@ -67,8 +72,15 @@ def test_mnl_estimation(obs, alts):
def test_mnl_prediction(obs, alts):
"""
Confirm that fitted probabilities in the new codebase match urbansim.urbanchoice.
Only runs if the urbansim package has been installed.
"""
try:
from urbansim.urbanchoice.mnl import mnl_simulate
except:
print("Comparison of MNL simulation results skipped because urbansim is not installed")
return

# produce a fitted model
mct = MergedChoiceTable(obs, alts, 'choice', 5)
m = MultinomialLogit(mct, model_expression='obsval + altval - 1')
Expand Down
3 changes: 1 addition & 2 deletions tests/test_mnl_urbansim.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""
Test data and results for this are generated
by the R script at data/mnl_tests.R.
These tests were brought over from UrbanSim.
"""
from __future__ import division
Expand Down

0 comments on commit 82386b3

Please sign in to comment.