Exemple #1
0
 def setUp(self):
     self._sense_conf = cmacpy.SignalConfiguration(0., 12., 13)
     self._sense_conf_2 = cmacpy.SignalConfiguration(0.1, 1., 10)
     self._sense_conf_3 = cmacpy.SignalConfiguration(-1, 1., 2)
     confs = []
     confs.append(self._sense_conf)
     confs.append(self._sense_conf_2)
     confs.append(self._sense_conf_3)
     self._cmacpy = cmacpy.CMAC(confs, 4)
Exemple #2
0
    def test_train_more_one_conf(self):
        confs = []
        confs.append(cmacpy.SignalConfiguration(-10., 10., 100))
        confs.append(cmacpy.SignalConfiguration(-10., 10., 100))
        _cmacpy = cmacpy.CMAC(confs, 4)
        data_in = None
        data_out = array([])
        for i in range(100):
            n1 = random.uniform(-100, 100)
            n2 = random.uniform(-100, 100)
            temp = array([[n1, n2]])
            if data_in == None:
                data_in = temp
            else:
                data_in = concatenate((data_in, temp))
            data_out = concatenate(
                (data_out, array([random.uniform(-100, 100)])))
        data_out = reshape(data_out, (len(data_out), 1))

        _train = cmacpy.Train(_cmacpy, data_in, data_out, 0.5, 10)
        _train.train()
Exemple #3
0
 def generate_cmacpy(self):
     x_axis = cmacpy.SignalConfiguration(-10, 10, 100, 'X axis')
     y_axis = cmacpy.SignalConfiguration(-10, 10, 100, 'Y axis')
     self._cmacpy = cmacpy.CMAC([x_axis, y_axis], 5)
Exemple #4
0
 def generate_cmacpy(self):
     conf = cmacpy.SignalConfiguration(-m.pi, m.pi, 100,
                                       'Sin function between -pi and pi')
     ann = cmacpy.CMAC([conf], 2)
     self._cmacpy = ann
Exemple #5
0
 def test_train_one_conf(self):
     confs = []
     confs.append(cmacpy.SignalConfiguration(-10., 10., 100))
     ann = cmacpy.CMAC(confs, 4)
     _train = cmacpy.Train(ann, np.random.uniform(-10, 10, 500),
                           np.random.uniform(0, 1000, 500), 0.5, 50)