This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Time Series Testing | |
| import keras.callbacks | |
| from keras.models import Sequential | |
| from keras.layers.core import Dense, Activation, Dense, Dropout | |
| from keras.layers.recurrent import LSTM | |
| # Call back to capture losses | |
| class LossHistory(keras.callbacks.Callback): | |
| def on_train_begin(self, logs={}): | |
| self.losses = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| from random import random | |
| flow = (list(range(1,10,1)) + list(range(10,1,-1)))*1000 | |
| pdata = pd.DataFrame({"a":flow, "b":flow}) | |
| pdata.b = pdata.b.shift(9) | |
| data = pdata.iloc[10:] * random() # some noise | |
| import numpy as np |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ From: http://danielhnyk.cz/predicting-sequences-vectors-keras-using-rnn-lstm/ """ | |
| from keras.models import Sequential | |
| from keras.layers.core import TimeDistributedDense, Activation, Dropout | |
| from keras.layers.recurrent import GRU | |
| import numpy as np | |
| def _load_data(data, steps = 40): | |
| docX, docY = [], [] | |
| for i in range(0, data.shape[0]/steps-1): | |
| docX.append(data[i*steps:(i+1)*steps,:]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| error_reporting(E_ALL); | |
| define('NUM_FEATURES', 3); | |
| // My dataset describes cities around the world where I might consider living. | |
| // Each sample (city) consists of 3 features: | |
| // * Feature 1: average low winter temperature in the city | |
| // * Feature 2: city population, in millions |