Exemplo n.º 1
0
    def test_props(self):
        test_fcns = [
            TanSig(),
            PureLin(),
            LogSig(),
            HardLim(),
            HardLims(),
            Competitive(),
            SatLin(),
            SatLins()
        ]
        vars = [-1e50, -2.5, -0.5, 0.0, 0.1, 3.0, 1e50]
        for test_fcn in test_fcns:
            self.assertEqual(test_fcn.out_minmax[1] >= test_fcn.out_minmax[0],
                             True)
            self.assertEqual(test_fcn.inp_active[1] >= test_fcn.inp_active[0],
                             True)

            for v in vars:
                r = test_fcn(np.array([v]))
                self.assertEqual(
                    test_fcn.out_minmax[0] <= r <= test_fcn.out_minmax[1],
                    True)
def hardlims(n):
    global t_res
    test_fcn = HardLims()
    # print test_fcn(n)
    return test_fcn(n)