def init_pop(self):
        """initializes population of features as GP stacks."""
        pop = Pop(self.population_size)
        seed_with_raw_features = False
        # make programs
        if self.seed_with_ml:
            # initial population is the components of the default ml model
            if (self.ml_type == 'SVC' or self.ml_type == 'SVR'):
                # this is needed because svm has a bug that throws valueerror
                #on attribute check
                seed_with_raw_features=True
            elif (hasattr(self.pipeline.named_steps['ml'],'coef_') or
                  hasattr(self.pipeline.named_steps['ml'],'feature_importances_')):
                # add model components with non-zero coefficients to initial
                # population, in order of coefficient size
                coef = (self.pipeline.named_steps['ml'].coef_ if
                        hasattr(self.pipeline.named_steps['ml'],'coef_') else
                        self.pipeline.named_steps['ml'].feature_importances_)
                # compress multiple coefficients for each feature into single
                # numbers (occurs with multiclass classification)
                if len(coef.shape)>1:
                    coef = [np.mean(abs(c)) for c in coef.transpose()]

                # remove zeros
                coef = [c for c in coef if c!=0]
                # sort feature locations based on importance/coefficient
                locs = np.arange(len(coef))
                locs = locs[np.argsort(np.abs(coef))[::-1]]
                for i,p in enumerate(pop.individuals):
                    if i < len(locs):
                        p.stack = [node('x',loc=locs[i])]
                    else:
                        # make program if pop is bigger than n_features
                        self.make_program(p.stack,self.func_set,self.term_set,
                                     self.random_state.randint(self.min_depth,
                                                       self.max_depth+1),
                                     self.otype)
                        p.stack = list(reversed(p.stack))
            else:
                seed_with_raw_features = True
            # seed with random features if no importance info available
            if seed_with_raw_features:
                for i,p in enumerate(pop.individuals):
                    if i < self.n_features:
                        p.stack = [node('x',
                                        loc=self.random_state.randint(self.n_features))]
                    else:
                        # make program if pop is bigger than n_features
                        self.make_program(p.stack,self.func_set,self.term_set,
                                     self.random_state.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:",
                      self.stacks_2_eqns(pop.individuals))

        else: # don't seed with ML
            for I in pop.individuals:
                depth = self.random_state.randint(self.min_depth,self.max_depth_init)
                self.make_program(I.stack,self.func_set,self.term_set,depth,
                             self.otype)
                #print(I.stack)
                I.stack = list(reversed(I.stack))

        return pop
initializes population of features as GP stacks.