示例#1
0
 def generate_mf_group(self, G, x):
     mf_group = {}
     for (k, v) in G.iteritems():
         shp = v['shp']
         mf = v['mf']
         if mf == 'trap':
             mf_group[k] = trapmf(x, shp)
         if mf == 'tri':
             mf_group[k] = trimf(x, shp)
         if mf == 'gbell':
             mf_group[k] = gbellmf(x, shp[0], shp[1], shp[2])
         if mf == 'gauss':
             mf_group[k] = gaussmf(x, shp[0], shp[1])
         if mf == 'gauss2':
             mf_group[k] = gauss2mf(x, shp[0], shp[1])
         if mf == 'sig':
             mf_group[k] = sigmf(x, shp[0], shp[1])
         if mf == 'psig':
             mf_group[k] = psigmf(x, shp[0], shp[1], shp[2], shp[3])
         if mf == 'zmf':
             mf_group[k] = zmf(x, shp[0], shp[1], shp[2], shp[3])
         if mf == 'smf':
             mf_group[k] = smf(x, shp[0], shp[1], shp[2], shp[3])
         if mf == 'pimf':
             mf_group[k] = pimf(x, shp[0], shp[1], shp[2], shp[3])
         if mf == 'piecemf':
             mf_group[k] = piecemf(x, shp[0], shp[1], shp[2], shp[3])
     return mf_group
示例#2
0
def test_psigmf():
    x = np.arange(-4, 4.1, 0.1)
    b1, c1, b2, c2 = -1.75, -np.pi / 2., 0.972, 0.43
    expected = ((1 / (1. + np.exp(- c1 * (x - b1)))) *
                (1 / (1. + np.exp(- c2 * (x - b2)))))
    test = psigmf(x, b1, c1, b2, c2)
    assert_allclose(test, expected)
示例#3
0
def test_psigmf():
    x = np.arange(-4, 4.1, 0.1)
    b1, c1, b2, c2 = -1.75, -np.pi / 2., 0.972, 0.43
    expected = ((1 / (1. + np.exp(-c1 * (x - b1)))) *
                (1 / (1. + np.exp(-c2 * (x - b2)))))
    test = psigmf(x, b1, c1, b2, c2)
    assert_allclose(test, expected)
示例#4
0
 def generate_mf_group(self, G, x):
     mf_group = {}
     for (k, v) in G.iteritems():
         shp = v['shp']
         mf = v['mf']
         if mf == 'trap':
             mf_group[k] = trapmf(x, shp)
         if mf == 'tri':
             mf_group[k] = trimf(x, shp)
         if mf == 'gbell':
             mf_group[k] = gbellmf(x, shp[0], shp[1], shp[2])
         if mf == 'gauss':
             mf_group[k] = gaussmf(x, shp[0], shp[1])
         if mf == 'gauss2':
             mf_group[k] = gauss2mf(x, shp[0], shp[1])
         if mf == 'sig':
             mf_group[k] = sigmf(x, shp[0], shp[1])
         if mf == 'psig':
             mf_group[k] = psigmf(x, shp[0], shp[1], shp[2], shp[3])
         if mf == 'zmf':
             mf_group[k] = zmf(x, shp[0], shp[1], shp[2], shp[3])
         if mf == 'smf':
             mf_group[k] = smf(x, shp[0], shp[1], shp[2], shp[3])
         if mf == 'pimf':
             mf_group[k] = pimf(x, shp[0], shp[1], shp[2], shp[3])
         if mf == 'piecemf':
             mf_group[k] = piecemf(x, shp[0], shp[1], shp[2], shp[3])
     return mf_group