Example #1
0
 def genotype_factory(self,
                      max_depth: int = None,
                      n_estimators: int = None):
     return OrderedDict({
         "max_depth":
         RandPoissonChromosome(
             value=max_depth if max_depth is not None else 3,
             min_val=2,
             max_val=None,
             output_dtype=int),
         "n_estimators":
         RandPoissonChromosome(
             value=n_estimators if n_estimators is not None else 10,
             min_val=2,
             max_val=None,
             output_dtype=int),
         "criterion":
         RandOptionsChromosome(options=["mse", "mae"]),
         "max_features":
         RandOptionsChromosome(options=["auto", "sqrt", "log2"]),
         "warm_start":
         RandUniformBooleanChromosome(),
         "bootstrap":
         RandUniformBooleanChromosome()
     })
 def genotype_factory(self):
     return OrderedDict({
         "n_neighbors" : RandPoissonChromosome(
             value=4,
             min_val=2,
             max_val=None,
             output_dtype=int
         ),
         "weights": RandOptionsChromosome(options=[
             "uniform",
             "distance"
         ]),
         "algorithm": RandOptionsChromosome(options=[
             "ball_tree",
             "kd_tree",
             "brute"
         ]),
         "metric": RandOptionsChromosome(options=[
             "euclidean",
             "manhattan",
             "chebyshev"
         ]),
         "leaf_size": RandPoissonChromosome(
             value=rand_int(2, 32),
             min_val=3,
             max_val=None,
             output_dtype=int
         )
     })
Example #3
0
 def genotype_factory(
     self,
     regressor_chromosome=None,
     n_estimators: int = None,
 ):
     return OrderedDict({
         "base_estimator":
         regressor_chromosome if regressor_chromosome is not None else
         DecisionTreeRegressorChromosome(),
         "n_estimators":
         RandPoissonChromosome(
             value=n_estimators if n_estimators is not None else 50,
             min_val=2,
             max_val=None,
             output_dtype=int),
         "max_samples":
         RandGaussChromosome(
             value=rand_real(),
             min_val=0.1,
             max_val=1.,
         ),
         "max_features":
         RandGaussChromosome(value=rand_real(), min_val=0.1, max_val=1.0),
         "warm_start":
         RandUniformBooleanChromosome()
     })
Example #4
0
 def genotype_factory(self,
                      layers: int = 6,
                      min_layers: int = 2,
                      max_layers=512):
     return OrderedDict({
         "hidden_layer_sizes":
         RandArrayChromosome(length=layers,
                             fixed=False,
                             generator=RandPoissonChromosome(
                                 value=rand_int(min_val=min_layers,
                                                max_val=max_layers),
                                 min_val=min_layers,
                                 max_val=max_layers,
                                 output_dtype=int)),
         "activation":
         RandOptionsChromosome(
             options=["logistic", "tanh", "relu", "identity"]),
         "solver":
         RandOptionsChromosome(options=["lbfgs", "sgd", "adam"]),
         "learning_rate":
         RandOptionsChromosome(
             options=["constant", "invscaling", "adaptive"]),
         "shuffle":
         RandUniformBooleanChromosome(),
         "warm_start":
         RandUniformBooleanChromosome(),
         "max_iter":
         RandOptionsChromosome(options=[256, 512, 1024, 2048, 4096]),
     })
Example #5
0
 def genotype_factory(self,
                      max_depth: int = None,
                      learning_rate: float = None,
                      n_estimators: int = None):
     return OrderedDict({
         "max_depth":
         RandPoissonChromosome(
             value=max_depth if max_depth is not None else rand_int(2, 16),
             min_val=2,
             max_val=None,
             rounding=None,
             output_dtype=int),
         "learning_rate":
         RandGaussChromosome(
             value=learning_rate if learning_rate is not None else 0.1,
             min_val=0.01,
             max_val=0.99,
             rounding=2),
         "n_estimators":
         RandPoissonChromosome(value=n_estimators if n_estimators
                               is not None else rand_int(2, 128),
                               min_val=2,
                               max_val=None,
                               output_dtype=int),
         "objective":
         RandOptionsChromosome(
             options=["reg:linear", "reg:gamma", "reg:tweedie"]),
         "booster":
         RandOptionsChromosome(options=["gbtree", "gblinear", "dart"]),
         "base_score":
         RandGaussChromosome(value=0.5,
                             min_val=0.01,
                             max_val=0.99,
                             rounding=3),
         "gamma":
         RandGaussChromosome(value=rand_real(),
                             min_val=0.01,
                             max_val=0.99,
                             rounding=3)
     })
Example #6
0
 def genotype_factory(self,
                      n_estimators: int = None,
                      learning_rate: float = None,
                      max_depth: int = None,
                      alpha: float = None):
     return OrderedDict({
         "n_estimators":
         RandPoissonChromosome(
             value=n_estimators if n_estimators is not None else 128,
             min_val=2),
         "loss":
         RandOptionsChromosome(options=["ls", "lad", "huber", "quantile"]),
         "learning_rate":
         RandGaussChromosome(
             value=learning_rate if learning_rate is not None else 0.1,
             min_val=0.001,
             max_val=0.999,
             rounding=3,
             output_dtype=np.float64),
         "max_features":
         RandOptionsChromosome(options=["auto", "sqrt", "log2"]),
         "max_depth":
         RandPoissonChromosome(
             value=max_depth if max_depth is not None else 6,
             min_val=2,
             max_val=None,
             rounding=None,
             output_dtype=np.int64),
         "criterion":
         RandOptionsChromosome(options=["mse", "mae", "friedman_mse"]),
         "warm_start":
         RandUniformBooleanChromosome(),
         "alpha":
         RandGaussChromosome(value=alpha if alpha is not None else 0.9,
                             min_val=0.01,
                             max_val=0.99,
                             rounding=2,
                             output_dtype=np.float64)
     })
 def genotype_factory(self, max_depth: int = None):
     return OrderedDict({
         "splitter":
         RandOptionsChromosome(options=["best", "random"]),
         "criterion":
         RandOptionsChromosome(options=["mse", "mae", "friedman_mse"]),
         "max_depth":
         RandPoissonChromosome(
             value=max_depth if max_depth is not None else rand_int(2, 16),
             min_val=2,
             max_val=None,
             rounding=None,
             output_dtype=int),
         "max_features":
         RandOptionsChromosome(options=["auto", "sqrt", "log2"])
     })
Example #8
0
 def genotype_factory(self,
                      n_estimators: int = None,
                      learning_rate: float = None,
                      regressor_chromosome=None):
     return OrderedDict({
         "base_estimator":
         regressor_chromosome if regressor_chromosome is not None else
         DecisionTreeRegressorChromosome(),
         "n_estimators":
         RandPoissonChromosome(
             value=n_estimators if n_estimators is not None else 50,
             min_val=2,
             max_val=None,
             output_dtype=int),
         "learning_rate":
         RandGaussChromosome(value=learning_rate
                             if learning_rate is not None else rand_real(),
                             min_val=0.01,
                             max_val=1.0,
                             rounding=3,
                             output_dtype=np.float32),
         "loss":
         RandOptionsChromosome(options=["linear", "square", "exponential"])
     })