Beispiel #1
0
    def test_InceptionTime_metrics(self):
        """InceptionTime model should be compiled with the metrics that we give it"""
        metrics = ['accuracy', 'mae']
        x_shape = (None, 20, 3)
        nr_classes = 2
        X_train, y_train = generate_train_data(x_shape, nr_classes)

        model_type = InceptionTime(x_shape, nr_classes, metrics=metrics)
        model = model_type.create_model(16)
        model.fit(X_train, y_train)

        model_metrics = [m.name for m in model.metrics]
        for metric in metrics:
            assert metric in model_metrics
Beispiel #2
0
    def test_ResNet_metrics(self):
        """ResNet model should be compiled with the metrics that we give it"""
        metrics = ['accuracy', 'mae']
        x_shape = (None, 20, 3)
        nr_classes = 2
        X_train, y_train = generate_train_data(x_shape, nr_classes)

        model_type = ResNet(x_shape, nr_classes, metrics=metrics)
        model = model_type.create_model(16, 20)
        model.fit(X_train, y_train, epochs=1)

        model_metrics = [m.name for m in model.metrics]
        for metric in metrics:
            assert metric in model_metrics
Beispiel #3
0
    def test_cnn_metrics(self):
        """CNN model should be compiled with the metrics that we give it"""
        metrics = ['accuracy', 'mae']
        x_shape = (None, 20, 3)
        nr_classes = 2
        X_train, y_train = generate_train_data(x_shape, nr_classes)

        model_type = CNN(x_shape, nr_classes, metrics=metrics)
        model = model_type.create_model(**{
            "filters": [32, 32],
            "fc_hidden_nodes": 100
        })
        model.fit(X_train, y_train, epochs=1)

        model_metrics = [m.name for m in model.metrics]
        for metric in metrics:
            assert metric in model_metrics