Created
January 1, 2018 01:29
-
-
Save khuangaf/dff60889920aa41d4c0ae509a5c4c9c7 to your computer and use it in GitHub Desktop.
CryptocurrencyPrediction
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,:] | |
original_A = np.array(original_df)[:,None,:] | |
time_stamps = np.array(time_stamps)[:,None,None] | |
#Make samples of temporal sequences of pricing data (channel) | |
NPS, NFS = 256, 16 #Number of past and future samples | |
ps = PastSampler(NPS, NFS, sliding_window=False) | |
B, Y = ps.transform(A) | |
input_times, output_times = ps.transform(time_stamps) | |
original_B, original_Y = ps.transform(original_A) | |
import h5py | |
with h5py.File(file_name, 'w') as f: | |
f.create_dataset("inputs", data = B) | |
f.create_dataset('outputs', data = Y) | |
f.create_dataset("input_times", data = input_times) | |
f.create_dataset('output_times', data = output_times) | |
f.create_dataset("original_datas", data=np.array(original_df)) | |
f.create_dataset('original_inputs',data=original_B) | |
f.create_dataset('original_outputs',data=original_Y) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment