示例#1
0
from array_module import reshape_input

from csv_module import load_execution_files

#linux
#base_directory          = '/home/jadson/git/deeplearning/data'
#macos
base_directory = '/Users/jadson/git/deeplearning/data'

lstm_model = base_directory + '/lstm_model.h5'

# size of the data set
sample_number = 1
timesteps = 100
features = 1

# load model from single file
model = load_model(lstm_model)

print(' ------- loading traning data ------ ')
x = load_execution_files(base_directory, sample_number)

x = reshape_input(x, 1, timesteps,
                  features)  # 256 samples x 100 timesteps x 1 features

print(x)

# make predictions
yhat = model.predict(x, verbose=0)
#yhat = model.predict_classes(x, verbose=1)
print(yhat)
示例#2
0
classes = 10

#configuration of lstm
lstm_layer_size = 100
dence_layer_size = 10
batch_size = 16
epochs = 100

# ======================================================

# =============  LOAD THE TRANING DATA  FROM THE /data/training  ===============

print(' ------- loading traning data ------ ')
x_train = load_traning_files(training_directory, traning_samples)

x_train3d = reshape_input(x_train, traning_samples, timesteps,
                          features)  # 256 samples x 100 timesteps x 1 features

print(' ------- loading traning output data ------ ')

y_train = load_traning_output_files(
    training_directory, traning_samples)  # 256 samples x 10 classes

# =============  LOAD THE TEST DATA FROM THE /data/tests  ===============

print(' ------- loading test data ------ ')
x_test = load_test_files(test_directory,
                         test_samples)  #  100 timesteps x 1 feature

x_test3d = reshape_input(x_test, test_samples, timesteps,
                         features)  # 10 samples x 100 timesteps x 1 feature
示例#3
0
#features_indexes = [0,1,2,3,5]

lstm_layer_size = 32
dence_layer_size = 10
batch_size = 64
epochs = 10
# ======================================================

# ==================== prepare LSTM data ===============

#prepareLSTMdata(raw_data_file_name, deep_network_file_name, features_indexes)

cvs_raw_data = load_csv_data2(deep_network_file_name)
#print(cvs_raw_data)

x_train = reshape_input(cvs_raw_data, samples, timesteps,
                        features)  # 1 x 10 x 5
#print('### 4 ###')
#print(lstm_input_data)

y_train = np.array([[0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9,
                     1.0]])  # 1 x 10

# 5 features, 10 timesteps
x_test = array([[0.1, 1.0, 0.1, 1.0, 0.0], [0.2, 0.9, 0.1, 1.0, 0.0],
                [0.3, 0.8, 0.1, 1.0, 0.0], [0.4, 0.7, 0.1, 1.0, 0.0],
                [0.5, 0.6, 0.1, 1.0, 0.0], [0.6, 0.5, 0.1, 1.0, 0.0],
                [0.7, 0.4, 0.1, 1.0, 0.0], [0.8, 0.3, 0.1, 1.0, 0.0],
                [0.9, 0.2, 0.1, 1.0, 0.0], [1.0, 0.1, 0.1, 1.0, 0.0]])

x_test = reshape_input(x_test, samples, timesteps, features)  # 1 x 10 x 5