MCPcopy Create free account
hub / github.com/Morgansy/Genetic-Alpha / __init__

Method __init__

_program.py:171–213  ·  view source on GitHub ↗
(self,
                 function_set,
                 arities,
                 paras,
                 init_depth,
                 init_method,
                 n_features,
                 const_range,
                 metric,
                 p_point_replace,
                 parsimony_coefficient,
                 random_state,
                 transformer=None,
                 feature_names=None,
                 program=None)

Source from the content-addressed store, hash-verified

169 """
170
171 def __init__(self,
172 function_set,
173 arities,
174 paras,
175 init_depth,
176 init_method,
177 n_features,
178 const_range,
179 metric,
180 p_point_replace,
181 parsimony_coefficient,
182 random_state,
183 transformer=None,
184 feature_names=None,
185 program=None):
186
187 self.function_set = function_set
188 self.arities = arities
189 self.paras = paras
190 self.init_depth = (init_depth[0], init_depth[1] + 1)
191 self.init_method = init_method
192 self.n_features = n_features
193 self.const_range = const_range
194 self.metric = metric
195 self.p_point_replace = p_point_replace
196 self.parsimony_coefficient = parsimony_coefficient
197 self.transformer = transformer
198 self.feature_names = feature_names
199 self.program = program
200
201 if self.program is not None:
202 if not self.validate_program():
203 raise ValueError('The supplied program is incomplete.')
204 else:
205 # Create a naive random program
206 self.program = self.build_program(random_state)
207
208 self.raw_fitness_ = None
209 self.fitness_ = None
210 self.parents = None
211 self._n_samples = None
212 self._max_samples = None
213 self._indices_state = None
214
215 def build_program(self, random_state):
216 """Build a naive random program.

Callers

nothing calls this directly

Calls 2

validate_programMethod · 0.95
build_programMethod · 0.95

Tested by

no test coverage detected