russelljjarvis / NUResults

for draw IO flow chart
0 stars 1 forks source link

Informatics Poster. #1

Open russelljjarvis opened 7 years ago

russelljjarvis commented 7 years ago

@rgerkin

After a refactoring the algorithm, the result is a plot of the genealogy history of the genetic algorithm where purple is the greatest error and yellow is the least greatest error (now there is a bar depicting this also).

You can see that now, at least some genes are being discarded, as is expected. The initial nodes have a zero error because their history was updated before not after their fitness was evaluated.

I am still doing something wrong with the error, but I feel that it should be a simple fix.

image

By comparison what it should look (more) like: image

Image from http://deap.readthedocs.io/en/master/api/tools.html#history

The immediately below two steps have been moved into neuronunit-optimization/Dockerfile

!sudo apt-get install python-dev graphviz libgraphviz-dev pkg-config
!pip install git+https://github.com/pygraphviz/pygraphviz

The actual code

import networkx
graph = networkx.DiGraph(history.genealogy_tree)
graph = graph.reverse()
labels ={}
for i in graph.nodes():
    labels[i] = i
colors = np.log([ np.sum(history.genealogy_history[i].fitness.values) for i in graph ])
positions = graphviz_layout(graph, prog="dot")
networkx.draw(graph, positions, node_color=colors, labels = labels)
plt.savefig('genealogy_history_{0}_.png'.format(gen))

I have also been working on this flow chart which could probably benefit from input and criticism (although I only started it this morning).

https://www.draw.io/?lightbox=1&highlight=0000ff&edit=_blank&layers=1&nav=1&title=flow_chart.xml#Uhttps%3A%2F%2Fraw.githubusercontent.com%2Frusselljjarvis%2Finformatics_poster%2Fmaster%2Fflow_chart.xml

Generally when A GA is working the whole population should converge onto the solution spaces. I think I have just made a simple error such as inverting the weights again or the error sign.

I also am going to use a plot of the GA evolution statics: image

Which basically tells the same story, Ie that I have configured the current GA to maximize error rather than minimizing it, however I believe the plot will be good when I fix and re run.

By borrowing and appropriating code from https://github.com/BlueBrain/BluePyOpt/blob/master/examples/graupnerbrunelstdp/run_fit.py#L29-L71