示例#1
0
 def __init__(self, sampler=None, params={}):
     ''' Define default parameters '''
     super().__init__(sampler)
     self.name = 'Online'
     self.params['Presampled points'] = Parameter(
         name='Presampled points',
         value=15,
         type=int,
         description='Pre-sampled points before starting regression')
     self.params['Iterations'] = Parameter(
         name='Iterations',
         type=int,
         value=10,
         description='Number of sample/fit cycles')
     self.params['Batch size'] = Parameter(
         name='Batch size',
         value=10,
         type=int,
         description='Points sampled per iteration')
     self.params['Tolerance'] = Parameter(
         name='Tolerance',
         value=0.01,
         min=1e-4,
         max=1e-1,
         description='Relative tolerance required for convergence')
     self.params['Mode'] = Parameter(
         name='Mode',
         value=['Optimizer', 'Explorer', 'Hybrid'],
         type=str,
         description='Peak-seeking behavior.')
     for p in params:
         self.params[p].value = params[p]
示例#2
0
 def __init__(self,
              params={},
              state=None,
              bounds=None,
              cost=None,
              substate=None):
     super().__init__()
     self.params = {}
     self.params['Population'] = Parameter(
         name='Population',
         value=20,
         type=int,
         description='Initial population size')
     self.params['Tolerance'] = Parameter(
         name='Tolerance', value=0.01, description='Convergence criterion')
     self.params['Mutation'] = Parameter(
         name='Population size',
         value=1,
         min=0,
         max=2,
         description=
         'Mutation constant in [0,2]. Larger values increase search radius but slow down convergence.'
     )
     self.params['Recombination'] = Parameter(
         name='Recombination',
         value=0.7,
         min=0,
         max=1,
         description=
         'Crossover probability. Increasing this value allows a larger number of mutants to progress into the next generation, but at the risk of population stability.'
     )
     for p in params:
         self.params[p].value = params[p]
     super().__init__(state, bounds, cost, substate)
示例#3
0
 def __init__(self):
     ''' Define default parameters '''
     self.name = 'PID'
     self.params = {}
     self.params['Proportional gain'] = Parameter(
         name='Proportional gain',
         value=1,
         min=0,
         max=100,
         description='Proportional gain')
     self.params['Integral gain'] = Parameter(name='Integral gain',
                                              value=0.1,
                                              min=0,
                                              max=10,
                                              description='Integral gain')
     self.params['Derivative gain'] = Parameter(
         name='Derivative gain',
         value=0,
         min=0,
         max=100,
         description='Derivative gain')
     self.params['Sign'] = Parameter(name='Sign',
                                     value=-1,
                                     min=-1,
                                     max=1,
                                     description='Sign of correction')
示例#4
0
 def __init__(self, sampler=None, params={}):
     ''' Define default parameters '''
     super().__init__(sampler)
     self.name = 'Grid'
     self.params['Steps'] = Parameter(name= 'Steps',
                                         value = 20,
                                         type = int,
                                         description = 'Grid points per dimension')
     self.params['Sweeps'] = Parameter(name= 'Sweeps',
                                         value = 1,
                                         type = int,
                                         description = 'Number of sweeps to do')
     for p in params:
         self.params[p].value = params[p]
示例#5
0
    def __init__(self, params={}, state=None, bounds=None, cost=None, substate=None):
        super().__init__()
        self.params = {}

        self.params['Tolerance'] = Parameter(name= 'Tolerance',
                                            value = 0.01,
                                            description = 'Convergence criterion')
        for p in params:
            self.params[p].value = params[p]
        super().__init__(state, bounds, cost, substate)
示例#6
0
 def __init__(self):
     super().__init__('GaussianProcess')
     self.params['Amplitude'] = Parameter(name= 'Kernel amplitude',
                                         value = 1,
                                         min = 0,
                                         max = 10,
                                         description = 'Amplitude of modeled cost landscape')
     self.params['Length scale'] = Parameter(name= 'Kernel length scale',
                                         value = 1,
                                         min = 0,
                                         max = 10,
                                         description = 'Characteristic size of cost landscape')
     self.params['Noise'] = Parameter(name= 'Kernel noise',
                                         value = 0.1,
                                         min = 0,
                                         max = 10,
                                         description = 'Amplitude of modeled white noise process')
     kernel = C(self.params['Amplitude'].value, (1e-3, 1e3)) * RBF(self.params['Length scale'].value, (1e-2, 1e2)) + WhiteKernel(self.params['Noise'].value)
     self.model = GaussianProcessRegressor(kernel=kernel, n_restarts_optimizer=10)
     self.extension = '.gp'
示例#7
0
 def __init__(self, name=None):
     self.name = name
     self.params = {}
     self.params['Leash'] = Parameter(
         name='Leash',
         value=0.25,
         min=0.01,
         max=0.25,
         description='Allowed search range relative to last best point')
     self.imported = False
     self.extension = None
示例#8
0
    def __init__(self,
                 params={},
                 state=None,
                 bounds=None,
                 cost=None,
                 substate=None):
        self.params = {}

        self.params['Steps'] = Parameter(
            name='Steps',
            type=int,
            value=20,
            description='Grid points per dimension')
        self.params['Sweeps'] = Parameter(name='Sweeps',
                                          value=1,
                                          type=int,
                                          description='Number of sweeps to do')
        for p in params:
            self.params[p].value = params[p]
        super().__init__(state, bounds, cost, substate)
示例#9
0
 def __init__(self, params={}):
     super().__init__()
     self.params = {}
     self.params['Optimizer'] = Parameter(name='Optimizer',
                                          value=self.list_optimizers(),
                                          type=str)
     for p in params:
         self.params[p].value = params[p]
         if p == 'Optimizer':
             self.optimizer = params['Optimizer']
             self.optimizer.measure = self.measure
示例#10
0
 def __init__(self,
              params={},
              state=None,
              bounds=None,
              cost=None,
              substate=None):
     super().__init__()
     ''' Define default parameters '''
     self.name = 'Adam'
     self.params = {}
     self.params['Learning rate'] = Parameter(
         name='Learning rate',
         value=0.1,
         description='Scaling factor for steps along the gradient')
     self.params['Tolerance'] = Parameter(
         name='Tolerance',
         value=0.01,
         description=
         'Convergence is detected when the gradient is this fraction of the max gradient'
     )
     self.params['Dither size'] = Parameter(
         name='Dither size',
         value=0.01,
         description='Step size for gradient estimation')
     self.params['Beta_1'] = Parameter(
         name='Beta_1',
         value=0.9,
         min=0.8,
         max=0.99,
         description='Exponential decay rate for first-moment estimates')
     self.params['Beta_2'] = Parameter(
         name='Beta_2',
         value=0.999,
         min=0.9,
         max=0.999,
         description='Exponential decay rate for second-moment estimates')
     self.params['Noise'] = Parameter(
         name='Noise',
         value=0,
         description='Noise injection for stochastic optimization')
     for p in params:
         self.params[p].value = params[p]
     super().__init__(state, bounds, cost, substate)
示例#11
0
    def __init__(self,
                 params={},
                 state=None,
                 bounds=None,
                 cost=None,
                 substate=None):
        super().__init__()
        self.params = {}
        self.params['Steps'] = Parameter(name='Steps', type=int, value=10)
        self.params['Particles'] = Parameter(name='Particles',
                                             type=int,
                                             value=10)
        self.params['Velocity scale'] = Parameter(
            name='Initial velocity scale', value=1)
        self.params['Inertia'] = Parameter(name='Inertia', value=1)
        self.params['Cognitive acceleration'] = Parameter(
            name='Cognitive acceleration', value=0.1)
        self.params['Social acceleration'] = Parameter(
            name='Social acceleration', value=0.1)

        for p in params:
            self.params[p].value = params[p]
        super().__init__(state, bounds, cost, substate)
示例#12
0
 def __init__(self, params={}):
     super().__init__()
     self.params = {'Threshold': Parameter(name='Threshold', value=0.5)}
     for p in params:
         self.params[p].value = params[p]
示例#13
0
 def __init__(self, params={'Loops': 1}):
     super().__init__()
     self.params = {}
     self.params['Loops'] = Parameter(name='Loops', value=1, type=int)
     for p in params:
         self.params[p].value = params[p]