with os.fdopen(os.open("lstm_training_data/schachnovelle.txt", os.O_RDONLY)) as f:
    input_text = f.read()


# initialize data store object
data_store = DataStore(
        input_data_set=set(input_text),
        output_data_set=set(input_text),
        input_data=input_text)
# set data_store configuration
data_store.configure({
    "sequence_length": config["time_steps"]
})

# samples is a generator object for sequences of length data_store.config['time_steps']
samples = data_store.samples()

# Uncomment to use random samples for training. The amount specifies the number of sequences
# to be trained during one iteration. After each iteration the sequences will be shuffled again.
#samples = data_store.random_samples(amount=20)

lstm = LSTMNetwork()

# apply configuration to lstm config
lstm.configure(config)
# tell the network the function to use for printing status information while training
lstm.get_status = util.get_status_function(data_store, lstm, config["status_frequency"])
# Populate layers
lstm.populate(
    in_size=np.shape(samples[0][0])[0],  # input size of first lstm unit - according to input vector size
    out_size=np.shape(samples[0][0])[0],  # output size of output layer - according to input/output vector size