项目作者: jfzhang95

项目描述 :
Theano实施我们的论文“开发长期短期记忆(LSTM)预测农业地区水位深度的模型”,水文学报。
高级语言: Jupyter Notebook
项目地址: git://github.com/jfzhang95/LSTM-water-table-depth-prediction.git
创建时间: 2018-01-08T02:48:38Z
项目社区:https://github.com/jfzhang95/LSTM-water-table-depth-prediction

开源协议:MIT License

下载


LSTM based Model for Water Table Depth Prediction

Introduction

This is a Theano implementation of our work Developing a Long Short-Term Memory (LSTM) based Model for Predicting Water Table Depth in Agricultural Areas. [Paper]

NEW: PyTorch implementation also available: Water-Table-Depth-Prediction-PyTorch!

Requirements

  1. Python3.x(Tested with 3.5)
  2. theano(Tested with 1.0.1)
  3. numpy
  4. pandas
  5. scikit-learn

Installation

The code was tested with Python 3.5. To use this code, please do:

  1. Clone the repo:

    1. git clone https://github.com/jfzhang95/LSTM-water-table-depth-prediction.git
    2. cd LSTM-water-table-depth-prediction
  2. Install dependencies:

    1. pip install theano matplotlib numpy pandas scikit-learn
  3. To try the demo code, please run:

    1. python demo.py

If installed correctly, the result should look like this:
results

Noted that the demo data (demo.csv) are processed manually, so they are not real data, but they still can reflect the correlation between the original data.

Tutorials

A model training and testing pipeline can be defined as:

  1. def LSTM_FC_prediction(X, Y, X_test=None, iters=20000, learning_rate=1e-4, dropout_prob=0.5):
  2. if dropout_prob > 1. or dropout_prob < 0.:
  3. raise Exception('Dropout level must be in interval [0, 1]')
  4. num_month = Y.shape[0]
  5. input_shathinkpe = X.shape[1]
  6. model = LSTM_FC_Model(num_input=input_shape, num_hidden=[40], num_output=1)
  7. print('Start training......')
  8. for iter in range(iters + 1):
  9. loss = model.fit(X, Y, learning_rate, dropout_prob)
  10. if iter % 1000 == 0:
  11. print("iteration: %s, loss: %s" % (iter, loss))
  12. # Saving model
  13. model.save_model_params('checkpoints/LSTM_FC_CKPT')
  14. print('Start predicting......')
  15. Y_test = model.predict(X_test)
  16. print('Done.')
  17. return Y_test

For more details, please see in tuitorials.

Citation

If you use this code, please consider citing the following paper:

  1. @article{zjf18,
  2. journal = {Journal of Hydrology},
  3. title = {Developing a Long Short-Term Memory (LSTM) based Model for Predicting Water Table Depth in Agricultural Areas},
  4. author = {Jianfeng Zhang, Yan Zhu, Xiaoping Zhang, Ming Ye and Jinzhong Yang},
  5. year = {2018},
  6. volume = {561},
  7. pages = {918-929}
  8. }

License

MIT