def test_with_step_minimization_alg(self):
        default_step = 0.3
        net1 = reproducible_network_train(step=default_step)
        net2 = reproducible_network_train(
            step=default_step,
            decay_rate=0.25,
            zero_weight=10,
            addons=[algorithms.WeightElimination]
        )
        net3 = reproducible_network_train(
            step=default_step,
            decay_rate=0.25,
            zero_weight=10,
            addons=[algorithms.WeightElimination,
                           algorithms.SimpleStepMinimization]
        )

        # Check that step is valid for each network
        StepCase = namedtuple('StepCase', 'network expected_step')
        step_test_cases = (
            StepCase(network=net1, expected_step=default_step),
            StepCase(network=net2, expected_step=default_step),
            StepCase(network=net3, expected_step=6. / default_step),
        )

        for case in step_test_cases:
            step = case.network.variables.step
            self.assertAlmostEqual(step.get_value(), case.expected_step,
                                   places=5)

        # Compare weight norm between networks
        WeightNormCase = namedtuple('WeightNormCase',
                                    'with_smaller_norm with_bigger_norm')
        norm_test_cases = (
            WeightNormCase(with_smaller_norm=net2, with_bigger_norm=net1),
            WeightNormCase(with_smaller_norm=net3, with_bigger_norm=net1),
        )
        for case in norm_test_cases:
            network_layers = zip(case.with_smaller_norm.layers,
                                 case.with_bigger_norm.layers)
            for smaller_norm, bigger_norm in network_layers:
                weight_smaller_norm = smaller_norm.weight.get_value()
                weight_bigger_norm = bigger_norm.weight.get_value()
                self.assertGreater(
                    np.linalg.norm(weight_bigger_norm),
                    np.linalg.norm(weight_smaller_norm)
                )
dataset/ETHPy150Open itdxer/neupy/tests/algorithms/weights/test_weight_elimination.py/WeightEliminationTestCase.test_with_step_minimization_alg/swapped operands of `/`