Using the TimeSeriesNnet() method from the nnet_ts module throws NameError

假装没事ソ 提交于 2019-12-04 19:24:21

Definitely, there is something wrong with your deployment of the code. For your Python developments, I suggest always use a local virtual environment. For this Neural Network Timeseries, you can build it locally with the python setup.py build command, it will build necessary files in the build/lib.linux-x86_64-2.7 directory. Assuming you have all dependencies, there shouldn't be any problem. In the deployment, you just have to set your PYTHONPATH to this directory, or you just include this path in the runtime with sys.path.insert() method.
For example, assuming I am in nnet-ts directory, I have built and run nnet-ts as follow:

    $ python setup.py build
    $ python
    > import sys
    > sys.path.insert(0, 'build/lib.linux-x86_64-2.7')
    > from nnet_ts import *
    > time_series = np.array(pd.read_csv("nnet_ts/AirPassengers.csv")["x"]) 
    > neural_net = TimeSeriesNnet(hidden_layers = [20, 15, 5], activation_functions = ['sigmoid', 'sigmoid', 'sigmoid'])
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!