Exemple #1
0
 def init_Population(self):
     self.pop = latin(self.pop_size, self.chrom_length, self.min_value, self.max_value)
    numy2 = newy[datanum - traindata:, ]

    model[0].fit(numx0, numy0)
    model[1].fit(numx1, numy1)
    model[2].fit(numx2, numy2)


if __name__ == '__main__':
    starttime = time.perf_counter()
    dimension = 10
    fun = fun.ellipsoid
    lower_bound = -5.12
    upper_bound = 5.12
    datanum = 11 * dimension

    x = latin(datanum, dimension, lower_bound, upper_bound)
    y = fun(x)
    model = [0] * 3
    traindata = int(datanum / 3)
    model[0] = RBFN(input_shape=dimension,
                    hidden_shape=int(np.sqrt(traindata)),
                    kernel='gaussian')
    model[1] = RBFN(input_shape=dimension,
                    hidden_shape=int(np.sqrt(traindata)),
                    kernel='gaussian')
    model[2] = RBFN(input_shape=dimension,
                    hidden_shape=int(np.sqrt(traindata)),
                    kernel='gaussian')
    resetmodel(x, y)

    max_iter = 100