コード例 #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.*")
コード例 #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")
コード例 #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")
コード例 #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")
コード例 #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")
コード例 #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.*")
コード例 #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")
コード例 #8
0
def test_precommit__Gradient():
    def method(model):
        return Gradient(model)

    dryrun.test_analyzer(method, "mnist.*")
コード例 #9
0
def test_imagenet__Gradient():
    def method(model):
        return Gradient(model)

    dryrun.test_analyzer(method, "imagenet.*")
コード例 #10
0
def test_precommit__BaselineGradient_pp_square():
    def method(model):
        return BaselineGradient(model, postprocess="square")

    dryrun.test_analyzer(method, "mnist.*")
コード例 #11
0
def test_fast__Gradient():
    def method(model):
        return Gradient(model)

    dryrun.test_analyzer(method, "trivia.*:mnist.log_reg")
コード例 #12
0
def test_imagenet__SmoothGrad():
    def method(model):
        return SmoothGrad(model, augment_by_n=2)

    dryrun.test_analyzer(method, "imagenet.*")
コード例 #13
0
def test_fast__BaselineGradient_pp_square():
    def method(model):
        return BaselineGradient(model, postprocess="square")

    dryrun.test_analyzer(method, "trivia.*:mnist.log_reg")
コード例 #14
0
def test_precommit__BoundedDeepTaylor():
    def method(model):
        return BoundedDeepTaylor(model, low=-1, high=1)

    dryrun.test_analyzer(method, "mnist.*")
コード例 #15
0
def test_fast__GuidedBackprop():
    def method(model):
        return GuidedBackprop(model)

    dryrun.test_analyzer(method, "trivia.*:mnist.log_reg")
コード例 #16
0
def test_fast__DeepTaylor():
    def method(model):
        return DeepTaylor(model)

    dryrun.test_analyzer(method, "trivia.*:mnist.log_reg")
コード例 #17
0
def test_imagenet__DeepTaylor():
    def method(model):
        return DeepTaylor(model)

    dryrun.test_analyzer(method, "imagenet.*")
コード例 #18
0
def test_fast__IntegratedGradients():
    def method(model):
        return IntegratedGradients(model)

    dryrun.test_analyzer(method, "trivia.*:mnist.log_reg")
コード例 #19
0
def test_imagenet__GuidedBackprop():
    def method(model):
        return GuidedBackprop(model)

    dryrun.test_analyzer(method, "imagenet.*")
コード例 #20
0
def test_precommit__GuidedBackprop():
    def method(model):
        return GuidedBackprop(model)

    dryrun.test_analyzer(method, "mnist.*")
コード例 #21
0
def test_precommit__Gradient_pp_None():
    def method(model):
        return Gradient(model, postprocess=None)

    dryrun.test_analyzer(method, "mnist.*")
コード例 #22
0
def test_precommit__Deconvnet():
    def method(model):
        return Deconvnet(model)

    dryrun.test_analyzer(method, "mnist.*")
コード例 #23
0
def test_precommit__IntegratedGradients():
    def method(model):
        return IntegratedGradients(model)

    dryrun.test_analyzer(method, "mnist.*")
コード例 #24
0
def test_imagenet__Deconvnet():
    def method(model):
        return Deconvnet(model)

    dryrun.test_analyzer(method, "imagenet.*")
コード例 #25
0
def test_precommit__DeepTaylor():
    def method(model):
        return DeepTaylor(model)

    dryrun.test_analyzer(method, "mnist.*")
コード例 #26
0
def test_imagenet__IntegratedGradients():
    def method(model):
        return IntegratedGradients(model, steps=2)

    dryrun.test_analyzer(method, "imagenet.*")
コード例 #27
0
def test_fast__BoundedDeepTaylor():
    def method(model):
        return BoundedDeepTaylor(model, low=-1, high=1)

    dryrun.test_analyzer(method, "trivia.*:mnist.log_reg")
コード例 #28
0
def test_fast__SmoothGrad():
    def method(model):
        return SmoothGrad(model)

    dryrun.test_analyzer(method, "trivia.*:mnist.log_reg")
コード例 #29
0
def test_imagenet__BoundedDeepTaylor():
    def method(model):
        return BoundedDeepTaylor(model, low=-1, high=1)

    dryrun.test_analyzer(method, "imagenet.*")
コード例 #30
0
def test_precommit__SmoothGrad():
    def method(model):
        return SmoothGrad(model)

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