Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Commit c65ee97

Browse files
author
damart
committed
Minor changes and cleaning
1 parent 0411cdc commit c65ee97

File tree

8 files changed

+934
-186
lines changed

8 files changed

+934
-186
lines changed

bluepyopt/deapext/CMA_MO.py

Lines changed: 7 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from . import utils
3535
from . import hype
3636

37-
logger = logging.getLogger(__name__)
37+
logger = logging.getLogger('__main__')
3838

3939

4040
def get_hyped(pop):
@@ -142,42 +142,10 @@ def __init__(self,
142142
def _select(self, candidates):
143143
"""Select the best candidates of the population
144144
145-
Fill the next population (chosen) with the Pareto fronts until there is
146-
not enouch space. When an entire front does not fit in the space left
147-
we rely on the hypervolume for this front. The remaining fronts are
148-
explicitly not chosen"""
149-
150-
#if len(candidates) <= self.mu:
151-
# return candidates, []
152-
153-
#pareto_fronts = deap.tools.sortLogNondominated(candidates,
154-
# len(candidates))
155-
156-
#chosen = list()
157-
#mid_front = None
158-
#not_chosen = list()
159-
160-
#full = False
161-
#for front in pareto_fronts:
162-
# if len(chosen) + len(front) <= self.mu and not full:
163-
# chosen += front
164-
# elif mid_front is None and len(chosen) < self.mu:
165-
# mid_front = front
166-
# # With this front, we selected enough individuals
167-
# full = True
168-
# else:
169-
# not_chosen += front
170-
171-
# HypE contribution to get the best candidates on the remaining front
172-
#k = self.mu - len(chosen)
173-
#if k > 0:
174-
# contribution = get_hyped(mid_front)
175-
# print(contribution)
176-
# idxs = numpy.argsort(contribution)
177-
# ordered_front = [mid_front[i] for i in idxs[::-1]]
178-
# chosen += ordered_front[:k]
179-
# not_chosen += ordered_front[k:]
180-
145+
The quality of an individual is based on a mixture of
146+
absolute fitness and hyper-volume contribution.
147+
"""
148+
181149
if self.weight_hv == 0.:
182150
fit = [numpy.sum(ind.fitness.values) for ind in candidates]
183151
idx_fit = list(numpy.argsort(fit))
@@ -195,7 +163,8 @@ def _select(self, candidates):
195163
idx_fit = list(numpy.argsort(fit))
196164
scores = []
197165
for i in range(len(candidates)):
198-
score = (self.weight_hv * idx_hv.index(i)) + ((1.-self.weight_hv) * idx_fit.index(i))
166+
score = (self.weight_hv * idx_hv.index(i)) + \
167+
((1.-self.weight_hv) * idx_fit.index(i))
199168
scores.append(score)
200169
idx_scores = list(numpy.argsort(scores))
201170

bluepyopt/deapext/CMA_SO.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
from . import utils
3636

37-
logger = logging.getLogger(__name__)
37+
logger = logging.getLogger('__main__')
3838

3939

4040
class CMA_SO(cma.Strategy):

bluepyopt/deapext/algorithms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from .stoppingCriteria import MaxNGen
3535
from . import utils
3636

37-
logger = logging.getLogger(__name__)
37+
logger = logging.getLogger('__main__')
3838

3939

4040
def _define_fitness(pop, obj_size):

bluepyopt/deapext/hype.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import numpy
22

3+
34
def hypesub_(l, A, actDim, bounds, pvec, alpha, k):
45
h = numpy.zeros(l)
56
i = numpy.argsort(A[:, actDim - 1])

bluepyopt/deapext/optimisations.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import random
2626
import logging
2727
import functools
28-
import numpy
2928

3029
import deap
3130
import deap.base
@@ -38,7 +37,7 @@
3837

3938
import bluepyopt.optimisations
4039

41-
logger = logging.getLogger(__name__)
40+
logger = logging.getLogger('__main__')
4241

4342
# TODO decide which variables go in constructor,which ones go in 'run' function
4443
# TODO abstract the algorithm by creating a class for every algorithm, that way

bluepyopt/deapext/stoppingCriteria.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
import bluepyopt.stoppingCriteria
2626

27-
logger = logging.getLogger(__name__)
27+
logger = logging.getLogger('__main__')
2828

2929

3030
def isclose(a, b, rel_tol=1e-09, abs_tol=0.0):

examples/simplecell/simplecell.ipynb

Lines changed: 77 additions & 87 deletions
Large diffs are not rendered by default.

examples/tsodyksmarkramstp/tsodyksmarkramstp.ipynb

Lines changed: 845 additions & 56 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)