def setUp(self): self.training, self.validation, self.testing = load_samples( 'r_music', 0) topology = create_network_from_topology([2, 2]) self.sga = SimpleGeneticAlgorithm(100, MaxGenerationsCriterion(200), topology, SelectionOperatorTournament(5), MutationOperatorGaussian(0.05), CrossoverOperatorArithmetic(), 0.01, 0.5)
def __init__(self, data_set_name, metric=RootMeanSquaredError, models=_MODELS): """Initializes benchmark environment.""" self.data_set_name = data_set_name # Creates file name as combination of data set name and and date. self.file_name = self.data_set_name + "__" + _now.strftime( "%Y_%m_%d__%H_%M_%S") # Loads samples into object. self.samples = [ load_samples(data_set_name, index) for index in range(30) ] self.metric = metric self.models = models # If data set is classification problem, remove regression models. Else, vice versa. if is_classification(self.samples[0][0]): if 'svr' in self.models.keys(): del self.models['svr'] if 'mlpr' in self.models.keys(): del self.models['mlpr'] if 'rfr' in self.models.keys(): del self.models['rfr'] else: if 'svc' in self.models.keys(): del self.models['svc'] if 'mlpc' in self.models.keys(): del self.models['mlpc'] if 'rfc' in self.models.keys(): del self.models['rfc'] # Create results dictionary with models under study. self.results = { k: [None for i in self.samples] for k in self.models.keys() } # Serialize benchmark environment. benchmark_to_pickle(self)
def setUp(self): self.training, self.validation, self.testing = load_samples( 'c_cancer', 0)
def setUp(self): self.training, self.validation, self.testing = load_samples('c_cancer', 0) self.neat = Neat(100, MaxGenerationsCriterion(200), 4, 1, 1, 0.1, 0.1, 0.1, 0.1, 0.5, 0.01)
def setUp(self): base_learner = SemanticLearningMachine(50, MaxGenerationsCriterion(10), 2, 'optimized', 10, Mutation2()) self.ensemble_learner = Ensemble(base_learner, 50) self.training, self.validation, self.testing = load_samples( 'r_concrete', 0)