A program-like representation of the evolved program. This is the underlying data-structure used by the public classes in the :mod:`gplearn.genetic` module. It should not be used directly by the user. Parameters ---------- function_set : list A list of valid functions t
| 62 | |
| 63 | |
| 64 | class _Program(object): |
| 65 | |
| 66 | """A program-like representation of the evolved program. |
| 67 | |
| 68 | This is the underlying data-structure used by the public classes in the |
| 69 | :mod:`gplearn.genetic` module. It should not be used directly by the user. |
| 70 | |
| 71 | Parameters |
| 72 | ---------- |
| 73 | function_set : list |
| 74 | A list of valid functions to use in the program. |
| 75 | |
| 76 | arities : dict |
| 77 | A dictionary of the form `{arity: [functions]}`. The arity is the |
| 78 | number of arguments that the function takes, the functions must match |
| 79 | those in the `function_set` parameter. |
| 80 | |
| 81 | paras : dict |
| 82 | A dictionary of the form `{para: [functions]}`. The para is the type |
| 83 | of arguments that the function takes, the functions must match |
| 84 | those in the `function_set` parameter. |
| 85 | |
| 86 | init_depth : tuple of two ints |
| 87 | The range of tree depths for the initial population of naive formulas. |
| 88 | Individual trees will randomly choose a maximum depth from this range. |
| 89 | When combined with `init_method='half and half'` this yields the well- |
| 90 | known 'ramped half and half' initialization method. |
| 91 | |
| 92 | init_method : str |
| 93 | - 'grow' : Nodes are chosen at random from both functions and |
| 94 | terminals, allowing for smaller trees than `init_depth` allows. Tends |
| 95 | to grow asymmetrical trees. |
| 96 | - 'full' : Functions are chosen until the `init_depth` is reached, and |
| 97 | then terminals are selected. Tends to grow 'bushy' trees. |
| 98 | - 'half and half' : Trees are grown through a 50/50 mix of 'full' and |
| 99 | 'grow', making for a mix of tree shapes in the initial population. |
| 100 | |
| 101 | n_features : int |
| 102 | The number of features in `X`. |
| 103 | |
| 104 | const_range : tuple of two floats |
| 105 | The range of constants to include in the formulas. |
| 106 | |
| 107 | metric : _Fitness object |
| 108 | The raw fitness metric. |
| 109 | |
| 110 | p_point_replace : float |
| 111 | The probability that any given node will be mutated during point |
| 112 | mutation. |
| 113 | |
| 114 | parsimony_coefficient : float |
| 115 | This constant penalizes large programs by adjusting their fitness to |
| 116 | be less favorable for selection. Larger values penalize the program |
| 117 | more which can control the phenomenon known as 'bloat'. Bloat is when |
| 118 | evolution is increasing the size of programs without a significant |
| 119 | increase in fitness, which is costly for computation time and makes for |
| 120 | a less understandable final result. This parameter may need to be tuned |
| 121 | over successive runs. |
no outgoing calls
no test coverage detected