Exemplo n.º 1
0
def test_precommit__BaseReverseNetwork_reverse_check_minmax():
    def method(model):
        return Gradient(model,
                        reverse_verbose=True,
                        reverse_check_min_max_values=True)

    dryrun.test_analyzer(method, "mnist.*")
Exemplo n.º 2
0
def test_fast__BaseReverseNetwork_reverse_check_minmax():
    def method(model):
        return Gradient(model,
                        reverse_verbose=True,
                        reverse_check_min_max_values=True)

    dryrun.test_analyzer(method, "trivia.*:mnist.log_reg")
Exemplo n.º 3
0
def test_imagenet__PatternAttribution():
    def method(model):
        # enough for test purposes, only pattern application is tested here
        # pattern computation is tested separately.
        # assume that one dim weights are biases, drop them.
        patterns = [x for x in model.get_weights() if len(x.shape) > 1]
        return PatternAttribution(model, patterns=patterns)

    dryrun.test_analyzer(method, "imagenet.vgg16:imagenet.vgg19")
Exemplo n.º 4
0
def test_fast__PatternNet():
    def method(model):
        # enough for test purposes, only pattern application is tested here
        # pattern computation is tested separately.
        # assume that one dim weights are biases, drop them.
        patterns = [x for x in model.get_weights() if len(x.shape) > 1]
        return PatternNet(model, patterns=patterns)

    dryrun.test_analyzer(method, "mnist.log_reg")
Exemplo n.º 5
0
def test_fast__AnalyzerNetworkBase_neuron_selection_index():
    class CustomAnalyzer(Gradient):
        def analyze(self, X):
            index = 0
            return super(CustomAnalyzer, self).analyze(X, index)

    def method(model):
        return CustomAnalyzer(model, neuron_selection_mode="index")

    dryrun.test_analyzer(method, "trivia.*:mnist.log_reg")
Exemplo n.º 6
0
def test_precommit__AnalyzerNetworkBase_neuron_selection_index():
    class CustomAnalyzer(Gradient):
        def analyze(self, X):
            index = 3
            return super(CustomAnalyzer, self).analyze(X, index)

    def method(model):
        return CustomAnalyzer(model, neuron_selection_mode="index")

    dryrun.test_analyzer(method, "mnist.*")
Exemplo n.º 7
0
def test_fast__DryRunAnalyzerTestCase():
    """
    Sanity test for the TestCase.
    """
    def method(output_layer):
        class TestAnalyzer(object):
            def analyze(self, X):
                return X

        return TestAnalyzer()

    dryrun.test_analyzer(method, "trivia.*:mnist.log_reg")
Exemplo n.º 8
0
def test_precommit__Gradient():
    def method(model):
        return Gradient(model)

    dryrun.test_analyzer(method, "mnist.*")
Exemplo n.º 9
0
def test_imagenet__Gradient():
    def method(model):
        return Gradient(model)

    dryrun.test_analyzer(method, "imagenet.*")
Exemplo n.º 10
0
def test_precommit__BaselineGradient_pp_square():
    def method(model):
        return BaselineGradient(model, postprocess="square")

    dryrun.test_analyzer(method, "mnist.*")
Exemplo n.º 11
0
def test_fast__Gradient():
    def method(model):
        return Gradient(model)

    dryrun.test_analyzer(method, "trivia.*:mnist.log_reg")
Exemplo n.º 12
0
def test_imagenet__SmoothGrad():
    def method(model):
        return SmoothGrad(model, augment_by_n=2)

    dryrun.test_analyzer(method, "imagenet.*")
Exemplo n.º 13
0
def test_fast__BaselineGradient_pp_square():
    def method(model):
        return BaselineGradient(model, postprocess="square")

    dryrun.test_analyzer(method, "trivia.*:mnist.log_reg")
Exemplo n.º 14
0
def test_precommit__BoundedDeepTaylor():
    def method(model):
        return BoundedDeepTaylor(model, low=-1, high=1)

    dryrun.test_analyzer(method, "mnist.*")
Exemplo n.º 15
0
def test_fast__GuidedBackprop():
    def method(model):
        return GuidedBackprop(model)

    dryrun.test_analyzer(method, "trivia.*:mnist.log_reg")
Exemplo n.º 16
0
def test_fast__DeepTaylor():
    def method(model):
        return DeepTaylor(model)

    dryrun.test_analyzer(method, "trivia.*:mnist.log_reg")
Exemplo n.º 17
0
def test_imagenet__DeepTaylor():
    def method(model):
        return DeepTaylor(model)

    dryrun.test_analyzer(method, "imagenet.*")
Exemplo n.º 18
0
def test_fast__IntegratedGradients():
    def method(model):
        return IntegratedGradients(model)

    dryrun.test_analyzer(method, "trivia.*:mnist.log_reg")
Exemplo n.º 19
0
def test_imagenet__GuidedBackprop():
    def method(model):
        return GuidedBackprop(model)

    dryrun.test_analyzer(method, "imagenet.*")
Exemplo n.º 20
0
def test_precommit__GuidedBackprop():
    def method(model):
        return GuidedBackprop(model)

    dryrun.test_analyzer(method, "mnist.*")
Exemplo n.º 21
0
def test_precommit__Gradient_pp_None():
    def method(model):
        return Gradient(model, postprocess=None)

    dryrun.test_analyzer(method, "mnist.*")
Exemplo n.º 22
0
def test_precommit__Deconvnet():
    def method(model):
        return Deconvnet(model)

    dryrun.test_analyzer(method, "mnist.*")
Exemplo n.º 23
0
def test_precommit__IntegratedGradients():
    def method(model):
        return IntegratedGradients(model)

    dryrun.test_analyzer(method, "mnist.*")
Exemplo n.º 24
0
def test_imagenet__Deconvnet():
    def method(model):
        return Deconvnet(model)

    dryrun.test_analyzer(method, "imagenet.*")
Exemplo n.º 25
0
def test_precommit__DeepTaylor():
    def method(model):
        return DeepTaylor(model)

    dryrun.test_analyzer(method, "mnist.*")
Exemplo n.º 26
0
def test_imagenet__IntegratedGradients():
    def method(model):
        return IntegratedGradients(model, steps=2)

    dryrun.test_analyzer(method, "imagenet.*")
Exemplo n.º 27
0
def test_fast__BoundedDeepTaylor():
    def method(model):
        return BoundedDeepTaylor(model, low=-1, high=1)

    dryrun.test_analyzer(method, "trivia.*:mnist.log_reg")
Exemplo n.º 28
0
def test_fast__SmoothGrad():
    def method(model):
        return SmoothGrad(model)

    dryrun.test_analyzer(method, "trivia.*:mnist.log_reg")
Exemplo n.º 29
0
def test_imagenet__BoundedDeepTaylor():
    def method(model):
        return BoundedDeepTaylor(model, low=-1, high=1)

    dryrun.test_analyzer(method, "imagenet.*")
Exemplo n.º 30
0
def test_precommit__SmoothGrad():
    def method(model):
        return SmoothGrad(model)

    dryrun.test_analyzer(method, "mnist.*")