<commit_before># -*- coding: utf-8 -*-
"""An implementation of learning copying algorithm_learning with RNN (basic RNN, LSTM,
GRU).
Input sequence length: "1 ~ 20: (1*2+1)=3 ~ (20*2+1)=41"
Input dimension: "4"
Repeat times: "5"
Output sequence length: equal to input sequence length * repeat times.
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 Robot
from keras.utils.visualize_util import plot  # Add by Steven Robot
import time                                  # Add by Steven Robot
from keras.layers import Merge               # Add by Steven Robot
from keras.callbacks import ModelCheckpoint  # Add by Steven Robot
from keras.callbacks import Callback         # Add by Steven Robot
from util import LossHistory                 # Add by Steven Robot
import time                                  # Add by Steven Robot
import os                                    # Add by Steven Robot
import sys                                   # Add by Steven Robot



# Parameters for the model to train copying algorithm_learning
TRAINING_SIZE = 1024000
# TRAINING_SIZE = 10240
# TRAINING_SIZE = 128000
# TRAINING_SIZE = 1280
# INPUT_DIMENSION_SIZE = 4 + 1
# INPUT_DIMENSION_SIZE = 7 + 1
INPUT_DIMENSION_SIZE = 8 + 1
MAX_COPY_LENGTH = 10
# REPEAT_TIMES = 2
# MAX_INPUT_LENGTH = MAX_COPY_LENGTH + 1 + REPEAT_TIMES * MAX_COPY_LENGTH + 1
# MAX_REPEAT_TIMES = 5
MAX_REPEAT_TIMES = 10
MAX_INPUT_LENGTH = MAX_COPY_LENGTH + 1 + MAX_REPEAT_TIMES * MAX_COPY_LENGTH  # + 1

# Try replacing SimpleRNN, GRU, or LSTM
# RNN = recurrent.SimpleRNN
# RNN = recurrent.GRU
RNN = recurrent.LSTM
# HIDDEN_SIZE = 128  # acc. 99.9%
HIDDEN_SIZE = 128*4
LAYERS = 2
# LAYERS = MAX_REPEAT_TIMES
# BATCH_SIZE = 1024<commit_msg>Add more training data for learning repeat copy task can get rapid convergence. 4 times data.<commit_after># -*- coding: utf-8 -*-
"""An implementation of learning copying algorithm_learning with RNN (basic RNN, LSTM,
GRU).
Input sequence length: "1 ~ 20: (1*2+1)=3 ~ (20*2+1)=41"
Input dimension: "4"
Repeat times: "5"
Output sequence length: equal to input sequence length * repeat times.
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 Robot
from keras.utils.visualize_util import plot  # Add by Steven Robot
import time                                  # Add by Steven Robot
from keras.layers import Merge               # Add by Steven Robot
from keras.callbacks import ModelCheckpoint  # Add by Steven Robot
from keras.callbacks import Callback         # Add by Steven Robot
from util import LossHistory                 # Add by Steven Robot
import time                                  # Add by Steven Robot
import os                                    # Add by Steven Robot
import sys                                   # Add by Steven Robot



# Parameters for the model to train copying algorithm_learning
TRAINING_SIZE = 4*1024000
# TRAINING_SIZE = 10240
# TRAINING_SIZE = 128000
# TRAINING_SIZE = 1280
# INPUT_DIMENSION_SIZE = 4 + 1
# INPUT_DIMENSION_SIZE = 7 + 1
INPUT_DIMENSION_SIZE = 8 + 1
MAX_COPY_LENGTH = 10
# REPEAT_TIMES = 2
# MAX_INPUT_LENGTH = MAX_COPY_LENGTH + 1 + REPEAT_TIMES * MAX_COPY_LENGTH + 1
# MAX_REPEAT_TIMES = 5
MAX_REPEAT_TIMES = 10
MAX_INPUT_LENGTH = MAX_COPY_LENGTH + 1 + MAX_REPEAT_TIMES * MAX_COPY_LENGTH  # + 1

# Try replacing SimpleRNN, GRU, or LSTM
# RNN = recurrent.SimpleRNN
# RNN = recurrent.GRU
RNN = recurrent.LSTM
# HIDDEN_SIZE = 128  # acc. 99.9%
HIDDEN_SIZE = 128*4
LAYERS = 2
# LAYERS = MAX_REPEAT_TIMES
# BATCH_SIZE = 1024
{'fraction_non_alphanumeric': 0.06460009465215334, 'fraction_numerical': 0.03312825366777094, 'mean_word_length': 2.828804347826087, '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': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4815628', 'n_tokens_mistral': 1414, 'n_tokens_neox': 1256, 'n_words': 448}