示例#1
0
import rrn_utils


train_set = Dataset.load('./data/without_sol_one.pkl')
test_set = Dataset.load('./data/with_sol_one.pkl')

hyperparameters = {
    'device': 6,
    'dim_x': 2,
    'dim_y': 2,
    'num_iters': 32,
    'train_size': 3000,
    'valid_size': 500,
    'batch_size': 500,
    'epochs': 600,
    'valid_epochs': 25,
    'save_epochs': 25,
    'embed_size': 6,
    'hidden_layer_size': 32,
    'learning_rate': 1e-3,
    'weight_decay': 1e-4
}

rrn_utils.train_rrn(hyperparameters,
              train_inputs = train_set.get_input_data(0, 3000),
              train_outputs = train_set.get_output_data(0, 3000),
              other_inputs = { 'validation': train_set.get_input_data(3000, 3500),
                               'test': test_set.get_input_data(0, 500)},
              other_outputs = { 'validation': train_set.get_output_data(3000, 3500),
                               'test': test_set.get_output_data(0, 500)})
示例#2
0
    'device': 4,
    'dim_x': 2,
    'dim_y': 2,
    'num_iters': 32,
    'train_size': train_size_per_num_hints * 12,
    'valid_size': valid_size_per_num_hints * 12,
    'batch_size': 500,
    'epochs': 600,
    'save_epochs': 25,
    'embed_size': 6,
    'hidden_layer_size': 32,
    'learning_rate': 1e-3,
    'weight_decay': 1e-4
}

dataset = Datasets.load('./data/datasets.pkl')

split_inputs, split_outputs = dataset.split_data([
    train_size_per_num_hints,
    train_size_per_num_hints + valid_size_per_num_hints
])

data = {
    'train_inputs': split_inputs[0],
    'train_outputs': split_outputs[0],
    'valid_inputs': split_inputs[1],
    'valid_outputs': split_outputs[1]
}

train_rrn(hyperparameters, data)
示例#3
0
sys.path.append(SUDOKU_PATH + '/src/models')

from dataset import Dataset
from rrn_utils import train_rrn

train_set = Dataset.load('./data/train_set.pkl')
valid_set = Dataset.load('./data/valid_set.pkl')

devices = [4, 5, 6, 7, 8, 9]
print("Running on devices {}".format(devices))
hyperparameters = {
    'devices': devices,
    'dim_x': 3,
    'dim_y': 3,
    'num_iters': 32,
    'batch_size': 32 * len(devices),
    'epochs': 3,
    'valid_epochs': 25,
    'save_epochs': 25,
    'embed_size': 16,
    'hidden_layer_size': 96,
    'learning_rate': 1e-4,
    'weight_decay': 1e-4
}

train_rrn(hyperparameters,
          train_inputs=train_set.keys()[:10000],
          train_outputs=train_set.values()[:10000],
          other_inputs={"validation": valid_set.keys()},
          other_outputs={"validation": valid_set.values()})
示例#4
0
hyperparameters = {
    'device': 6,
    'dim_x': 2,
    'dim_y': 2,
    'num_iters': 32,
    'train_size': train_size_per_num_hints * 12,
    'valid_size': valid_size_per_num_hints * 12,
    'batch_size': 500,
    'epochs': 600,
    'valid_epochs': 25,
    'save_epochs': 25,
    'embed_size': 2,
    'hidden_layer_size': 32,
    'learning_rate': 1e-3,
    'weight_decay': 1e-4
}

dataset = Datasets.load('../../4x4_all_reimbed/data/datasets.pkl')

split_inputs, split_outputs = dataset.split_data([
    train_size_per_num_hints,
    train_size_per_num_hints + valid_size_per_num_hints
])

rrn_utils.train_rrn(hyperparameters,
                    train_inputs=split_inputs[0],
                    train_outputs=split_outputs[0],
                    other_inputs={'validation': split_inputs[1]},
                    other_outputs={'validation': split_outputs[1]})
示例#5
0
    'batch_size': 400,
    'epochs': 600,
    'save_epochs': 25,
    'embed_size': 6,
    'hidden_layer_size': 32,
    'learning_rate': 1e-3,
    'weight_decay': 1e-4
}

dataset = Datasets.load('./data/train_datasets.pkl')
ext_valid_datasets = Datasets.load('./data/ext_valid_datasets.pkl')

split_inputs, split_outputs = dataset.split_data([
    train_size_per_num_hints,
    train_size_per_num_hints + valid_size_per_num_hints
])
extrapolation_inputs, extrapolation_outputs = ext_valid_datasets.split_data(
    [valid_size_per_num_hints])

train_rrn(hyperparameters,
          train_inputs=split_inputs[0],
          train_outputs=split_outputs[0],
          other_inputs={
              "interpolation": split_inputs[1],
              "extrapolation": extrapolation_inputs[0]
          },
          other_outputs={
              "interpolation": split_outputs[1],
              "extrapolation": extrapolation_outputs[0]
          })