numpy as np from keras.layers import Dense, LSTM from keras.models import Sequential from sklearn.preprocessing import MinMaxScaler DATA_DIR = "./data" data = np.load(os.path.join(DATA_DIR, "LD_250.npy")) NUM_TIMESTEPS = 20 HIDDEN_SIZE = 10 BATCH_SIZE = 96 # 24 hours (15 min intervals) NUM_EPOCHS = 5 # scale the data to be in the range (0, 1) data = data.reshape(-1, 1) scaler = MinMaxScaler(feature_range=(0, 1), copy=False) data = scaler.fit_transform(data) # transform to 4 inputs -> 1 label format X = np.zeros((data.shape[0], NUM_TIMESTEPS)) Y = np.zeros((data.shape[0], 1)) for i in range(len(data) - NUM_TIMESTEPS - 1): X[i] = data[i:i + NUM_TIMESTEPS].T Y[i] = data[i + NUM_TIMESTEPS + 1] 予想値の算出プログラム1
自分でビルドする https://github.com/tensorflow/tensorflow/blob/master/tensorflow/ tools/lib_package/README.md 拡張命令を使用できるが、時間がかかる I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2