Giter VIP home page Giter VIP logo

nntimeseries's People

Contributors

mbinkowski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nntimeseries's Issues

GPU Version and run on Amazon AWS

Is there a GPU version of the code. i have tried running it my Intel Xeon server with 4 x Titan X Pascal GPUs , unfortunately it only uses CPU . Can it be run on Amazon AWS or on GPUs ,

where's cluster_results.pkl?

In results_display.py, all_results = pd.read_pickle(WDIR + '/results/cluster_results.pkl'). But there's no cluster_results.pkl in the data file.

Questions about `LSTM2.py`

Hello,

Thanks for making your code public on Github. I was wondering if there was something wrong with param_dict you defined in LSTM2.py:

# dictionary of hyperparameter lists across which the grid search will run
param_dict = dict(
    #input parameters
    ......
    target_cols=[1],    # 'default' or list of names of columns to predict  
    ......
)

When I run your code, I got following mistakes:

using <class '__main__.LSTMmodel'> to build the model
using <class 'nnts.artificial.ArtificialGenerator'> to draw samples
Traceback (most recent call last):
  File "LSTM2.py", line 106, in <module>
    runner.run(LSTMmodel, log=log, limit=1)
  File "/Users/jack-cheng/Desktop/毕业设计/时间序列/SOCNN/nntimeseries/nnts/utils.py", line 128, in run
    model = model_class(data, params, os.path.join(WDIR, 'tensorboard'))
  File "/Users/jack-cheng/Desktop/毕业设计/时间序列/SOCNN/nntimeseries/nnts/utils.py", line 228, in __init__
    self.idim, self.odim = self.G.get_dims(cols=self.target_cols)   
  File "/Users/jack-cheng/Desktop/毕业设计/时间序列/SOCNN/nntimeseries/nnts/utils.py", line 365, in get_dims
    return self.get_dim(), len(self.get_target_col_ids(cols=cols))
  File "/Users/jack-cheng/Desktop/毕业设计/时间序列/SOCNN/nntimeseries/nnts/artificial.py", line 223, in get_target_col_ids
    assert hasattr(cols, '__iter__')
AssertionError

When I set target_cols=['default'], it worked and produced result similar to that you proposed in the paper. Could you please tell me what do you mean by setting target_cols=[1]?

Reshape cannot infer the missing input size for an empty tensor

There was a typo also on line 159 of SOCNN.py when trying the shared_final_weights option

out = TimeDistributed(Dense(output_length ...

that I changed to

out = TimeDistributed(Dense(self.output_length ...

And got the training started with:

I tensorflow/core/common_runtime/gpu/gpu_device.cc:975] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 1070, pci bus id: 0000:01:00.0)
Total model parameters: 7196
---current learning rate: 0.00100000
Epoch 1/1000

But then the following error happend then:

Caused by op 'softmax/Reshape_1', defined at:
  File "nntimeseries/nnts/models/SOCNN.py", line 189, in <module>
    runner.run(SOCNNmodel, log=log, limit=6)
  File "nntimeseries/nnts/utils.py", line 150, in run
    model = model_class(data, params, os.path.join(WDIR, 'tensorboard'))
  File "nntimeseries/nnts/utils.py", line 263, in __init__
    self.nn, self.io_func, self.callbacks = self.build()
  File "nntimeseries/nnts/models/SOCNN.py", line 152, in build
    sig = TimeDistributed(Activation('softmax'), name='softmax')(sig)
  File "anaconda3/lib/python3.6/site-packages/keras/engine/topology.py", line 578, in __call__
    output = self.call(inputs, **kwargs)
  File "anaconda3/lib/python3.6/site-packages/keras/layers/wrappers.py", line 180, in call
    y = K.reshape(y, (-1, input_length) + output_shape[2:])
  File "anaconda3/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 1568, in reshape
    return tf.reshape(x, shape)
  File "anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/gen_array_ops.py", line 2630, in reshape
    name=name)
  File "anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 763, in apply_op
    op_def=op_def)
  File "anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 2327, in create_op
    original_op=self._default_original_op, op_def=op_def)
  File "anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1226, in __init__
    self._traceback = _extract_stack()

InvalidArgumentError (see above for traceback): Reshape cannot infer the missing input size for an empty tensor unless all specified input sizes are non-zero
	 [[Node: softmax/Reshape_1 = Reshape[T=DT_FLOAT, Tshape=DT_INT32, _device="/job:localhost/replica:0/task:0/gpu:0"](softmax/Softmax, softmax/Reshape_1/shape)]]
	 [[Node: add/_445 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/cpu:0", send_device="/job:localhost/replica:0/task:0/gpu:0", send_device_incarnation=1, tensor_name="edge_10390_add", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"]()]]

I guess I have to explicitly set shape for the sig of sig = TimeDistributed(Activation('softmax'), name='softmax')(sig) ?

FileNotFoundError: [Errno 2] No such file or directory: SOCNN.pkl

Thanks for sharing the code @mbinkowski of your interesting paper. However I had some issues trying to make the model run for the household data

For example, I got the following:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/petteri/anaconda3/lib/python3.6/site-packages/pandas/io/pickle.py", line 56, in try_read
    with open(path, 'rb') as fh:
FileNotFoundError: [Errno 2] No such file or directory: '/home/petteri/Dropbox/Data/nntimeseries/results/household_SOCNN.pkl'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "nntimeseries/nnts/models/SOCNN.py", line 158, in <module>
    runner.run(SOCNNmodel, limit=1)
  File "nntimeseries/nnts/utils.py", line 110, in run
    self.cresults = self._read_results()
  File "/nntimeseries/nnts/utils.py", line 64, in _read_results
    results = [v for k, v in pd.read_pickle(self.save_file).T.to_dict().items()]
  File "anaconda3/lib/python3.6/site-packages/pandas/io/pickle.py", line 68, in read_pickle
    return try_read(path, encoding='latin1')
  File "anaconda3/lib/python3.6/site-packages/pandas/io/pickle.py", line 61, in try_read
    with open(path, 'rb') as fh:
FileNotFoundError: [Errno 2] No such file or directory: '/Data/nntimeseries/results/household_SOCNN.pkl'

And on line 110 of utils.py, there is an attempt to read some results from pickled file that I don't have as I have never run the model yet successfully?

I replaced that with empty dictionary: self.cresults = {}, and had to add WDIR manually to some files, and then hit that when putting limit higher than 1:

using <class '__main__.SOCNNmodel'> to build the model
using <class 'nnts.household.HouseholdGenerator'> to draw samples
Traceback (most recent call last):
  File "nntimeseries/nnts/models/SOCNN.py", line 159, in <module>
    runner.run(SOCNNmodel, log=log, limit=6)
  File "nntimeseries/nnts/utils.py", line 150, in run
    model = model_class(data, params, os.path.join(WDIR, 'tensorboard'))
  File "nntimeseries/nnts/utils.py", line 263, in __init__
    self.nn, self.io_func, self.callbacks = self.build()
  File "nntimeseries/nnts/models/SOCNN.py", line 136, in build
    out = outL(main)
  File "anaconda3/lib/python3.6/site-packages/keras/engine/topology.py", line 578, in __call__
    output = self.call(inputs, **kwargs)
  File "anaconda3/lib/python3.6/site-packages/keras/layers/local.py", line 159, in call
    x_aggregate = K.concatenate(xs, axis=0)
  File "anaconda3/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 1553, in concatenate
    return tf.sparse_concat(axis, tensors)
  File "anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/sparse_ops.py", line 227, in sparse_concat
    inds, vals, shapes, axis, name=name))
  File "anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/gen_sparse_ops.py", line 428, in _sparse_concat
    concat_dim=concat_dim, name=name)
  File "anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 546, in apply_op
    (input_name, op_type_name, len(values), num_attr.minimum))
ValueError: List argument 'indices' to 'SparseConcat' Op with length 0 shorter than minimum length 2.

Any idea of the errors?

Printing weighting frame

Hello,

Your paper was an interesting read and thank you for making available the code. After following example.ipynb, I was wondering how I can print/visualize the weightings of the different 'candidate predictors'. It should be the case that B and D have high weightings for target variable E since E is a sum of last 10 values of B multiplied by D.
Which variable in SOCNN.py is the weighting frame? And do you have any suggestions what the best way is to print this?

Thank you in advance

ValueError: If printing histograms, validation_data must be provided, and cannot be a generator.

I am running

TF = 1.6 , Tensorboard = 1.5.0 and Keras 2.1.5 but i am getting this error below:

Developer@DEEPGPU:~/Downloads/nntimeseries-master/nnts/models# python ./CNN.py --dataset=artificial
....
...
...
..
...
Total model parameters: 3451
WARNING:tensorflow:From /home/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/base.py:198: retry (from tensorflow.contrib.learn.python.learn.datasets.base) is deprecated and will be removed in a future version.
Instructions for updating:
Use the retry module or similar alternatives.
Epoch 1/1000
---current learning rate: 0.00100000
124/124 [==============================] - 13s 103ms/step - loss: 1.2770 - val_loss: 2.7545

---current best val_loss: 2.75454
960/960 [==============================] - 0s 113us/step

--- test_loss: 2.290810
Traceback (most recent call last):
File "./CNN.py", line 109, in
runner.run(CNNmodel, log=log, limit=1)
File "/root/Downloads/nntimeseries-master/nnts/utils.py", line 130, in run
model_results, nn = model.run()
File "/root/Downloads/nntimeseries-master/nnts/utils.py", line 287, in run
verbose=self.verbose
File "/home/anaconda3/lib/python3.6/site-packages/keras/legacy/interfaces.py", line 91, in wrapper
return func(*args, **kwargs)
File "/home/anaconda3/lib/python3.6/site-packages/keras/engine/training.py", line 2262, in fit_generator
callbacks.on_epoch_end(epoch, epoch_logs)
File "/home/anaconda3/lib/python3.6/site-packages/keras/callbacks.py", line 77, in on_epoch_end
callback.on_epoch_end(epoch, logs)
File "/home/anaconda3/lib/python3.6/site-packages/keras/callbacks.py", line 820, in on_epoch_end
raise ValueError('If printing histograms, validation_data must be '
ValueError: If printing histograms, validation_data must be provided, and cannot be a generator.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.