This file contains 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
#include <cstdlib> | |
#include <cstddef> | |
#include <windows.h> | |
#include <string> | |
#include <iostream> | |
#define MOD_NOREPEAT 0x4000 | |
#define MOD_ALT 0x0001 | |
using namespace std; | |
void shortCut(int argc, TCHAR *argv[]); |
This file contains 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 json | |
import numpy as np | |
import os | |
import pandas as pd | |
import urllib2 | |
# connect to poloniex's API | |
url = 'https://poloniex.com/public?command=returnChartData¤cyPair=USDT_BTC&start=1356998100&end=9999999999&period=300' | |
# parse json returned from the API to Pandas DF |
This file contains 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 numpy as np | |
import pandas as pd | |
class PastSampler: | |
''' | |
Forms training samples for predicting future values from past value | |
''' | |
def __init__(self, N, K, sliding_window = True): | |
''' |
This file contains 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
file_name='bitcoin2015to2017_close.h5' | |
from sklearn.preprocessing import MinMaxScaler | |
scaler = MinMaxScaler() | |
# normalization | |
for c in columns: | |
df[c] = scaler.fit_transform(df[c].values.reshape(-1,1)) | |
#Features are input sample dimensions(channels) | |
A = np.array(df)[:,None,:] |
This file contains 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 | |
import numpy as numpy | |
from keras.models import Sequential | |
from keras.layers import Dense, Dropout, Activation, Flatten | |
from keras.layers import Conv1D, MaxPooling1D, LeakyReLU, PReLU | |
from keras.utils import np_utils | |
from keras.callbacks import CSVLogger, ModelCheckpoint | |
import h5py | |
import os | |
import tensorflow as tf |
This file contains 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 | |
import numpy as numpy | |
from keras.models import Sequential | |
from keras.layers import Dense, Dropout, Activation, Flatten,Reshape | |
from keras.layers import Conv1D, MaxPooling1D | |
from keras.utils import np_utils | |
from keras.layers import LSTM, LeakyReLU | |
from keras.callbacks import CSVLogger, ModelCheckpoint | |
import h5py | |
import os |
This file contains 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 | |
import numpy as numpy | |
from keras.models import Sequential | |
from keras.layers import Dense, Dropout, Activation, Flatten,Reshape | |
from keras.layers import Conv1D, MaxPooling1D, LeakyReLU | |
from keras.utils import np_utils | |
from keras.layers import GRU,CuDNNGRU | |
from keras.callbacks import CSVLogger, ModelCheckpoint | |
import h5py | |
import os |
This file contains 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 keras import applications | |
from keras.models import Sequential | |
from keras.models import Model | |
from keras.layers import Dropout, Flatten, Dense, Activation | |
from keras.callbacks import CSVLogger | |
import tensorflow as tf | |
from scipy.ndimage import imread | |
import numpy as np | |
import random | |
from keras.layers import LSTM |
This file contains 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
model.fit(training_datas, training_labels,verbose=1, batch_size=batch_size,validation_data=(validation_datas,validation_labels), epochs = epochs, callbacks=[CSVLogger(output_file_name+'.csv', append=True),ModelCheckpoint('weights/'+output_file_name+'-{epoch:02d}-{val_loss:.5f}.hdf5', monitor='val_loss', verbose=1,mode='min')] |
This file contains 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
predicted = model.predict(validation_datas) | |
predicted_inverted = [] | |
for i in range(original_datas.shape[1]): | |
scaler.fit(original_datas[:,i].reshape(-1,1)) | |
predicted_inverted.append(scaler.inverse_transform(predicted[:,:,i])) | |
print np.array(predicted_inverted).shape | |
#get only the close data | |
ground_true = ground_true[:,:,0].reshape(-1) | |
ground_true_times = ground_true_times.reshape(-1) |
OlderNewer