<commit_before># -*- coding: utf-8 -*-
'''An implementation of learning copying algorithm with RNN (basic RNN, LSTM,
GRU).
Input sequence length: "1 ~ 20: (1*2+1)=3 ~ (20*2+1)=41"
Input dimension: "8"
Output sequence length: equal to input sequence length.
Output dimension: equal to input dimension.
'''

from __future__ import print_function
from keras.models import Sequential
# from keras.engine.training import slice_X
from keras.layers import Activation, TimeDistributed, Dense, RepeatVector, recurrent
import numpy as np
# from six.moves import range

import dataset                               # Add by Steven Robot
import visualization                         # Add by Steven
from keras.utils.visualize_util import plot  # Add by Steven


# Parameters for the model to train copying algorithm
###
TRAINING_SIZE = 128000
# TRAINING_SIZE = 1280
# INPUT_DIMENSION_SIZE = 4 + 1
# MAX_COPY_LENGTH = 10
INPUT_DIMENSION_SIZE = 8 + 1
MAX_COPY_LENGTH = 20
MAX_INPUT_LENGTH = MAX_COPY_LENGTH + 1 + MAX_COPY_LENGTH

# Try replacing SimpleRNN, GRU, or LSTM
# RNN = recurrent.SimpleRNN
# RNN = recurrent.GRU
RNN = recurrent.LSTM
HIDDEN_SIZE = 128
LAYERS = 1
BATCH_SIZE = 128

# print('Generating data...')
# input_sequence, output_sequence = \
#     dataset.generate_copy_data(INPUT_DIMENSION_SIZE, MAX_INPUT_LENGTH)
# print(input_sequence.shape)
# print(input_sequence)
# print(output_sequence)
# visualization.show_copy_data(input_sequence.transpose(),
#                              output_sequence.transpose(),
#                              "experiment/copy_data_sample.png")
print('Generating data sets...')
# train, valid, test = dataset.generate_copy_data_sets(
#     INPUT_DIMENSION_SIZE, MAX_COPY_LENGTH, TRAINING_SIZE)<commit_msg>More training data for 8bits sequences copying training.<commit_after># -*- coding: utf-8 -*-
'''An implementation of learning copying algorithm with RNN (basic RNN, LSTM,
GRU).
Input sequence length: "1 ~ 20: (1*2+1)=3 ~ (20*2+1)=41"
Input dimension: "8"
Output sequence length: equal to input sequence length.
Output dimension: equal to input dimension.
'''

from __future__ import print_function
from keras.models import Sequential
# from keras.engine.training import slice_X
from keras.layers import Activation, TimeDistributed, Dense, RepeatVector, recurrent
import numpy as np
# from six.moves import range

import dataset                               # Add by Steven Robot
import visualization                         # Add by Steven
from keras.utils.visualize_util import plot  # Add by Steven


# Parameters for the model to train copying algorithm
###
TRAINING_SIZE = 1024000
# TRAINING_SIZE = 128000
# TRAINING_SIZE = 1280
# INPUT_DIMENSION_SIZE = 4 + 1
# MAX_COPY_LENGTH = 10
INPUT_DIMENSION_SIZE = 8 + 1
MAX_COPY_LENGTH = 20
MAX_INPUT_LENGTH = MAX_COPY_LENGTH + 1 + MAX_COPY_LENGTH

# Try replacing SimpleRNN, GRU, or LSTM
# RNN = recurrent.SimpleRNN
# RNN = recurrent.GRU
RNN = recurrent.LSTM
HIDDEN_SIZE = 128
LAYERS = 1
BATCH_SIZE = 128

# print('Generating data...')
# input_sequence, output_sequence = \
#     dataset.generate_copy_data(INPUT_DIMENSION_SIZE, MAX_INPUT_LENGTH)
# print(input_sequence.shape)
# print(input_sequence)
# print(output_sequence)
# visualization.show_copy_data(input_sequence.transpose(),
#                              output_sequence.transpose(),
#                              "experiment/copy_data_sample.png")
print('Generating data sets...')
# train, valid, test = dataset.generate_copy_data_sets(
#     INPUT_DIMENSION_SIZE, MAX_COPY_LENGTH, TRAINING_SIZE)
{'fraction_non_alphanumeric': 0.08880744290950099, 'fraction_numerical': 0.025373555117000283, 'mean_word_length': 3.853625170998632, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6137748', 'n_tokens_mistral': 1182, 'n_tokens_neox': 1071, 'n_words': 310}