예제 #1
0
    def test_mlp_model_output(self):
        folder_name, dataset_name, args = generate_dataset_and_parser()
        f = io.StringIO()
        with redirect_stdout(f):
            execute_train(encoder_class=MLPEncoder, decoder_class=MLPDecoder,
                          encoder_args=dict(hidden_size=5,
                                            layers=2),
                          decoder_args=dict(hidden_size=5,
                                            layers=2),
                          args=args)
        out = f.getvalue()

        # check correct output
        assert "Cost multiple" in out and "Final multiple val" in out and "Final loss_val" in out \
               and "Final loss_train" in out, 'Wrong output format'

        remove_files(folder_name, dataset_name)
예제 #2
0
    def test_cnn_model_output(self):
        folder_name, dataset_name, args = generate_dataset_and_parser()
        f = io.StringIO()
        with redirect_stdout(f):
            execute_train(encoder_class=CNNEncoder, decoder_class=CNNDecoder,
                          encoder_args=dict(readout_layers=1,
                                            channels=4,
                                            layers=2,
                                            kernel_size=3,
                                            non_linearity=True),
                          decoder_args=dict(readout_layers=1,
                                            channels=4,
                                            layers=2,
                                            kernel_size=3,
                                            non_linearity=True),
                          args=args)
        out = f.getvalue()

        # check correct output
        assert "Cost multiple" in out and "Final multiple val" in out and "Final loss_val" in out \
               and "Final loss_train" in out, 'Wrong output format'

        remove_files(folder_name, dataset_name)
예제 #3
0
from multiple_alignment.steiner_string.models.convolutional.model import CNNEncoder, CNNDecoder
from multiple_alignment.steiner_string.train import execute_train
from multiple_alignment.steiner_string.parser import general_arg_parser

parser = general_arg_parser()
parser.add_argument('--readout_layers', type=int, default=2, help='')
parser.add_argument('--channels', type=int, default=20, help='')
parser.add_argument('--layers', type=int, default=2, help='')
parser.add_argument('--kernel_size', type=int, default=3, help='')
parser.add_argument('--non_linearity', type=bool, default=False, help='')
args = parser.parse_args()

execute_train(encoder_class=CNNEncoder, decoder_class=CNNDecoder,
              encoder_args=dict(readout_layers=args.readout_layers,
                                channels=args.channels,
                                layers=args.layers,
                                kernel_size=args.kernel_size,
                                non_linearity=args.non_linearity),
              decoder_args=dict(readout_layers=args.readout_layers,
                                channels=args.channels,
                                layers=args.layers,
                                kernel_size=args.kernel_size,
                                non_linearity=args.non_linearity),
              args=args)