Exploration and Evolution: improvements
Release time 💪🏾!
Version 0.5.1 of neurolib
is out and we have some juicy improvements for exploration and evolution!
Evolution:
- NSGA-2 algorithm implemented (Deb et al. 2002)
- Preselect complete algorithms (using
algorithm="adaptive"
or"nsga2"
) - Implement custom operators for all evolutionary operations
- Keep track of the evolution history using
evolution.history
- Genealogy
evolution.tree
available fromevolution.buildEvolutionTree()
that isnetworkx
compatible [1] - Continue working:
saveEvolution()
andloadEvolution()
can load an evolution from another session [2] - Overview dataframe
evolution.dfPop
now has all fitness values as well - Get scores using
getScores()
- Plot evolution progress with
evolutionaryUtils.plotProgress()
Exploration:
- Use
loadResults(all=True)
to load all simulated results from disk to memory (available as.results
) or useall=False
to load runs individually from hdf. Both options populatedfResults
. loadResults()
has memory cap to avoid filling up RAMloadDfResults()
creates the parameter table from a previous simulationexplorationUtils.plotExplorationResults()
for plotting 2D slices of the explored results with some advanced functions like alpha maps and contours for predefined regions.
devUtils
- A module that we are using for development and research with some nice features. Please do not rely on this file since there might be breaking changes in the future.
plot_outputs()
like a true numerical simlordmodel_fit()
to compute the model's FC and FCD fit to the dataset, could be usefull for everyonegetPowerSpectrum()
does what is saysgetMeanPowerSpectrum()
same- a very neat
rolling_window()
from anumpy
PR that never got accepted
Other:
- Data loading:
Dataset
can load different SC matrix normalizations:"max", "waytotal", "nvoxel"
- Can precompute FCD matrices to avoid having to do it later (
fcd=True
)
neurolib/utils/atlas.py
added with aal2 region names (thanks @jajcayn) and coordinates of centers of regions (from scans of @caglorithm's brain 🤯)ParameterSpace
has.lowerBound
and.upperBound
.pypet
finally doesn't create a billion log files anymore due to a custom log config
[1] Plotting the genealogy tree:
import matplotlib.pyplot as plt
import networkx as nx
from networkx.drawing.nx_pydot import graphviz_layout
G = nx.DiGraph(evolution.tree)
G = G.reverse() # Make the graph top-down
pos = graphviz_layout(G, prog='dot')
plt.figure(figsize=(8, 8))
nx.draw(G, pos, node_size=50, alpha=0.5, node_color=list(evolution.id_score.values()), with_labels=False)
plt.show()
[2] Loading precomputed evolution
evaluateSimulation = lambda x: x # the funciton can be ommited, that's why we define a lambda here
pars = ParameterSpace(['a', 'b'], # should be same as previously saved evolution
[[0.0, 4.0], [0.0, 5.0]])
evolution = Evolution(evaluateSimulation, pars, weightList = [1.0])
evolution = evolution.loadEvolution("data/evolution-results-2020-05-15-00H-24M-48S.dill")