From 263be4e462983536d973b5c7b0bd6d2392f172d2 Mon Sep 17 00:00:00 2001 From: lacava Date: Mon, 17 Oct 2016 15:24:57 -0400 Subject: [PATCH] fixes ml seeding error when more features than individuals --- few/_version.py | 2 +- few/few.py | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/few/_version.py b/few/_version.py index b509b41..934e6d8 100644 --- a/few/_version.py +++ b/few/_version.py @@ -6,4 +6,4 @@ """ -__version__ = '0.0.6' +__version__ = '0.0.7' diff --git a/few/few.py b/few/few.py index 0c7bb59..4855a9a 100644 --- a/few/few.py +++ b/few/few.py @@ -496,11 +496,12 @@ def init_pop(self): raise(AttributeError) except Exception: # seed pop with raw features for i,p in it.zip_longest(range(self._training_features.shape[1]),pop.individuals,fillvalue=None): - if i is not None: - p.stack = [('x',0,i)] - else: - make_program(p.stack,self.func_set,self.term_set,np.random.randint(self.min_depth,self.max_depth+1),self.otype) - p.stack = list(reversed(p.stack)) + if p is not None: + if i is not None: + p.stack = [('x',0,i)] + else: + make_program(p.stack,self.func_set,self.term_set,np.random.randint(self.min_depth,self.max_depth+1),self.otype) + p.stack = list(reversed(p.stack)) # print initial population if self.verbosity > 2: print("seeded initial population:",stacks_2_eqns(pop.individuals))