This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Derek M. Tishler | |
# nx plot example deap individual | |
# For post: https://groups.google.com/g/deap-users/c/nZFZpm5OPZA | |
import matplotlib.pyplot as plt | |
import networkx as nx | |
from networkx.drawing.nx_agraph import graphviz_layout | |
## May need is resuming session | |
#from deap import creator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sklearn.decomposition | |
import sklearn.ensemble | |
import sklearn.linear_model | |
import sklearn.preprocessing | |
import sklearn.svm | |
from sklearn.datasets import load_breast_cancer | |
from sklearn.model_selection import train_test_split | |
from baikal import Input, Model, make_step | |
from baikal.plot import plot_model |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import array | |
import random | |
import numpy | |
from deap import algorithms | |
from deap import base | |
from deap import creator | |
from deap import tools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on https://raw.githubusercontent.com/DEAP/deap/master/examples/ga/onemax_mp.py | |
# Using onemax(ignore the problem sorta) to show how to work with only normalized individuals | |
# Can Uses numpy individuals but no multiproc: https://deap.readthedocs.io/en/master/examples/ga_onemax_numpy.html | |
# Derek M Tishler, Dec 2020 | |
import multiprocessing | |
import random | |
import sys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Derek Tishler | |
# Deap Hypervolume comparison for varying population size and number of objectives, | |
# testing for use with high dimensional NSGA III with many objectives (over 8).) | |
# Discussion here, also required fitness_values.txt with 212x14 array of fitness values per ind in pop: | |
# https://groups.google.com/g/deap-users/c/XLfLa3at6pw | |
import numpy as np |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example of creating an individual with multiple 'parts' | |
# Derek M Tishler, Oct 2020 | |
''' | |
Evolve a complex structure/individual, such as encoded hyperparamters of a mlp classifier | |
individual_example = [encoded_solver__int, learning_rate__float, hidden_units__list] | |
example of a 10 layer network using adam solver with learning rate ~0.007: | |
[0, 0.006592, [13, 89, 21, 100, 96, 100, 16, 67, 45, 88]] | |
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example of using selTournamentDCD requiring assignCrowdingDist | |
# Based on deap/examples/ga/onemax_numpy.py | |
# https://github.com/DEAP/deap/blob/master/examples/ga/onemax_numpy.py | |
# Discussion: | |
# https://groups.google.com/forum/#!topic/deap-users/uU382eztuts | |
import random |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Derek Tishler, answering a question from Deap Discussions: | |
# For Ning's question: https://groups.google.com/forum/#!topic/deap-users/W8wacFPyj9Y | |
# Based on symbreg example: https://github.com/DEAP/deap/blob/master/examples/gp/symbreg.py | |
# eaSimpleWithElitism from: https://github.com/PacktPublishing/Hands-On-Genetic-Algorithms-with-Python/blob/master/Chapter04/elitism.py | |
import operator | |
import math |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Derek Tishler | |
# Aug 3 2020 | |
# Based On: | |
# https://github.com/DEAP/deap/blob/master/examples/ga/onemax_short.py | |
# V2 | |
import array | |
import random | |
import numpy as np |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file is part of DEAP. | |
# | |
# DEAP is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU Lesser General Public License as | |
# published by the Free Software Foundation, either version 3 of | |
# the License, or (at your option) any later version. | |
# | |
# DEAP is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
NewerOlder