traja-team / traja

Python tools for spatial trajectory and time-series data analysis
https://traja.readthedocs.io
MIT License
98 stars 25 forks source link

JOSS Review - Example in latest docs (Predicting Trajectories) #83

Closed AbigailMcGovern closed 3 years ago

AbigailMcGovern commented 3 years ago

Hi Traja Team,

I just wanted to alert you to some issues relating to the examples in your latest docs.

As part of my review for JOSS, I needed to check that the functionality of the package matches that described in the paper and in the the documentation. I installed traja using pip and ran several examples in order to check the functionality of the package. Whilst the vast majority of the examples ran without a hitch, I hit a snag when I reached the section in the latest Traja documentation entitled 'Predicting Trajectories'. The code I ran and the error messages can be seen below.

In [1]: import traja
   ...: 
   ...: df = traja.dataset.example.jaguar()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-893a88ccfd56> in <module>
      1 import traja
      2 
----> 3 df = traja.dataset.example.jaguar()

AttributeError: module 'traja' has no attribute 'dataset'                                            
In [2]: from traja.models.predictive_models.lstm import LSTM
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-2-5a1f2cfeee79> in <module>
----> 1 from traja.models.predictive_models.lstm import LSTM

ModuleNotFoundError: No module named 'traja.models.predictive_models'
In [3]: from traja.models.train import HybridTrainer
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-3-33f84f9a8f5b> in <module>
----> 1 from traja.models.train import HybridTrainer

ModuleNotFoundError: No module named 'traja.models.train'

Upon further investigation, I learned that some of these modules were not included in the version available on PyPI (0.2.3) but are available in the development version (0.2.5). I installed the development version and attempted to run the examples. Again, this did not go perfectly smoothly.

data_loaders, scalers = dataset.MultiModalDataLoader(df,
                                                     batch_size=batch_size,
                                                     n_past=num_past,
                                                     n_future=num_future,
                                                     num_workers=1,
                                                     split_by_id=split_by_id)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-4-92ba49622f95> in <module>
     12 
     13 
---> 14 data_loaders, scalers = dataset.MultiModalDataLoader(df,
     15                                                      batch_size=batch_size,
     16                                                      n_past=num_past,

ValueError: too many values to unpack (expected 2)
model = LSTM(input_size=input_size,
             hidden_size=hidden_size,
             num_layers=num_layers,
             output_size=output_size,
             dropout=dropout,
             batch_size=batch_size,
             num_future=num_future)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-9-cc617c6111c5> in <module>
----> 1 model = LSTM(input_size=input_size,
      2              hidden_size=hidden_size,
      3              num_layers=num_layers,
      4              output_size=output_size,
      5              dropout=dropout,

TypeError: __init__() missing 3 required positional arguments: 'batch_first', 'reset_state', and 'bidirectional'
JustinShenk commented 3 years ago

Closing as solved by https://github.com/traja-team/traja/pull/86