示例#1
0
    def load_pipeline(self, fp):
        """
        Loads the state of the best pipeline and retrains.
        You are responsible for opening and closing the stream.

        After calling load, the best pipeline is **not** trained.
        You need to retrain it by calling `fit_pipeline(X, y)`.
        """
        sampler = ReplaySampler.load(fp)
        self.input, self.output = pickle.Unpickler(fp).load()
        self.best_pipeline_ = self._make_pipeline_builder()(sampler)
示例#2
0
    def _generate(self):
        # BUG: When multiprocessing is used for evaluation and no generation
        #      function is defined, the actual sampling occurs during fitness
        #      evaluation, and since that process has a copy of the solution
        #      we don't get the history in the `ReplaySampler`.

        sampler = ReplaySampler(self._build_sampler())

        if self._generator_fn is not None:
            solution = self._generator_fn(sampler)
        else:
            solution = sampler

        solution.sampler_ = sampler
        return solution