{"id":15677025,"url":"https://github.com/jrieke/timeseries-rnn","last_synced_at":"2025-08-01T16:34:48.655Z","repository":{"id":78974074,"uuid":"56875834","full_name":"jrieke/timeseries-rnn","owner":"jrieke","description":"⏱️  char-rnn for time series data","archived":false,"fork":false,"pushed_at":"2016-04-23T00:18:13.000Z","size":10,"stargazers_count":13,"open_issues_count":0,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-25T09:05:04.485Z","etag":null,"topics":["char-rnn","deep-learning","generation","machine-learning","prediction","stock-market","time-series","timeseries","timeseries-rnn"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jrieke.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-04-22T18:08:07.000Z","updated_at":"2020-07-25T02:21:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"7c7e0513-7849-4686-893f-9aec00de9bfc","html_url":"https://github.com/jrieke/timeseries-rnn","commit_stats":{"total_commits":6,"total_committers":1,"mean_commits":6.0,"dds":0.0,"last_synced_commit":"faa1ab2eff84ef70659a5624ee647bae12f674e6"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jrieke/timeseries-rnn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jrieke%2Ftimeseries-rnn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jrieke%2Ftimeseries-rnn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jrieke%2Ftimeseries-rnn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jrieke%2Ftimeseries-rnn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jrieke","download_url":"https://codeload.github.com/jrieke/timeseries-rnn/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jrieke%2Ftimeseries-rnn/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268260272,"owners_count":24221702,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["char-rnn","deep-learning","generation","machine-learning","prediction","stock-market","time-series","timeseries","timeseries-rnn"],"created_at":"2024-10-03T16:08:13.483Z","updated_at":"2025-08-01T16:34:48.620Z","avatar_url":"https://github.com/jrieke.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# timeseries-rnn\n\nThese scripts implement a recurrent neural network, which can generate new data from existing time series. The idea is inspired by Andrej Karparthy's (@karparthy) [char-rnn](http://karpathy.github.io/2015/05/21/rnn-effectiveness/), which does the same thing for text (see also his [blog post](http://karpathy.github.io/2015/05/21/rnn-effectiveness/)). The network consists of one or more LSTM layers and a layer implementing a Gaussian mixture model (instead of the softmax in char-rnn). Therefore, the network predicts the parameters of a mixture distribution, from which the values of the time series at the next time step can be sampled. See pp. 9-10 in my report [here](https://github.com/jrieke/lstm-biology/blob/master/Project%20Report.pdf) for more details. \n\nThe code is based on [keras](http://keras.io/) and [Theano](http://deeplearning.net/software/theano/) (Note: The Tensorflow backend doesn't work right now because of a custom layer which is implemented in Theano). \n\n## Usage\n\n\n### Training\n\n\tpython train.py data/stocks\n\nTrain the network on all files in `data/stocks`. Each file should contain one time series and look like this: \n\n\t1 2\n\t3 4\n\t5 6\n\nColumns are variables (here: 2) and rows are time steps (here: 3). The data is automatically normalized to mean 0 and standard deviation 1. If you want to train on the change of the data from time step to time step (this is recommended for time series that continually in- or decrease, e.g. stock prices), use `--change`. The trained network is saved in `model`. \n\nNote that the network architecture (namely the Gaussian mixture model layer) is quite prone to numeric errors. If you encounter a `nan` loss during training, try to reduce the learning rate (`--learning_rate VALUE`, default 0.001), use more standard deviations to normalize the data (`--stds VALUE`, default 1), or play around with the number of Gaussians in the mixture distribution (`--mixture_components VALUE`, default 10).\n\nArguments:\n\n\t--epochs EPOCHS                             number of training epochs\n\t--learning_rate LEARNING_RATE               learning rate of RMSprop\n\t--layers LAYERS                             number of LSTM layers\n\t--neurons NEURONS                           number of neurons per LSTM layer\n\t--mixture_components MIXTURE_COMPONENTS     number of Gaussians in the mixture distribution\n\t--change                                    use change of data for training (good for cumulative sequences)\n\t--stds STDS                                 number of standard deviations to normalize the data with\n\n\n### Prediction\n\n\tpython predict.py data/stocks\n\nUse the saved model to predict the next values in the time series for all files in `data/stocks`. The predicted time series are stored in the format above in the directory `predicted`. \n\n\n### Generation\n\n\tpython generate.py data/stocks\n\nUse the saved model to generate completely new time series. Parts of the CSV files in `data/stocks` are used as seeds to initialize the network state. The generated time series are stored in the format above in the directory `predicted`. \n\n\n## Requirements\n\n- Python 2.7\n- keras (v0.3.2)\n- Theano (v0.8.0.dev0)\n- numpy","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjrieke%2Ftimeseries-rnn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjrieke%2Ftimeseries-rnn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjrieke%2Ftimeseries-rnn/lists"}