1 Star 0 Fork 1

大乐乐 / LSTM-water-table-depth-prediction

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

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

Python3.x(Tested with 3.5)
theano(Tested with 1.0.1)
numpy
pandas
scikit-learn

Installation

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

  1. Clone the repo:

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

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

    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:

def LSTM_FC_prediction(X, Y, X_test=None, iters=20000, learning_rate=1e-4, dropout_prob=0.5):
    if dropout_prob > 1. or dropout_prob < 0.:
        raise Exception('Dropout level must be in interval [0, 1]')
    num_month = Y.shape[0]
    input_shathinkpe = X.shape[1]
    model = LSTM_FC_Model(num_input=input_shape, num_hidden=[40], num_output=1)
    print('Start training......')
    for iter in range(iters + 1):
        loss = model.fit(X, Y, learning_rate, dropout_prob)
        if iter % 1000 == 0:
            print("iteration: %s, loss: %s" % (iter, loss))
    # Saving model
    model.save_model_params('checkpoints/LSTM_FC_CKPT')

    print('Start predicting......')
    Y_test = model.predict(X_test)
    print('Done.')
    return Y_test

For more details, please see in tuitorials.

Citation

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

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

License

MIT

MIT License Copyright (c) 2018 Jianfeng Zhang Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

Theano implementation of our paper 'Developing a Long Short-Term Memory (LSTM) based Model for Predicting Water Table Depth in Agricultural Areas', Journal of Hydrology. 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/great_joy222/LSTM-water-table-depth-prediction.git
git@gitee.com:great_joy222/LSTM-water-table-depth-prediction.git
great_joy222
LSTM-water-table-depth-prediction
LSTM-water-table-depth-prediction
master

搜索帮助