83afa41b90bf670e905ff44f013665242c350f51,pyemma/_base/estimator.py,,estimate_param_scan,#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#,193

Before Change


        assert pool
        // the ctx manager will close and remove the processes, so we have to start new ones every time...
        with pool:
            res = pool(task_iter)
    // if n_jobs=1 don"t invoke the pool, but directly dispatch the iterator
    else:
        res = []
        for estimator, param_set in zip(estimators, param_sets):

After Change



    if n_jobs > 1:
        // iterate over parameter settings
        task_iter = ((estimator,
                      param_set, X,
                      evaluate,
                      evaluate_args,
                      failfast)
                     for estimator, param_set in zip(estimators, param_sets))

        from pathos.multiprocessing import Pool as Parallel
        pool = Parallel(processes=n_jobs)
        args = list(task_iter)
        if progress_reporter is not None:
            progress_reporter._progress_register(len(estimators), stage=0, description="estimating %s" % str(estimator.__class__.__name__))
            from pyemma._base.model import SampledModel
            for a in args:
                if isinstance(a[0], SampledModel):
                    a[0].show_progress = False

        def callback(_):
            progress_reporter._progress_update(1, stage=0)

        with pool:
            res_async = [pool.apply_async(_estimate_param_scan_worker, a, callback=callback) for a in args]
            res = [x.get() for x in res_async]

    // if n_jobs=1 don"t invoke the pool, but directly dispatch the iterator
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: markovmodel/PyEMMA
Commit Name: 83afa41b90bf670e905ff44f013665242c350f51
Time: 2017-08-28
Author: m.scherer@fu-berlin.de
File Name: pyemma/_base/estimator.py
Class Name:
Method Name: estimate_param_scan


Project Name: thunlp/OpenNRE
Commit Name: 9addf8e81b605208562d2aee90f9ac0c2c993d45
Time: 2019-11-03
Author: gaotianyu1350@126.com
File Name: opennre/module/pool/max_pool.py
Class Name: MaxPool
Method Name: forward


Project Name: rusty1s/pytorch_geometric
Commit Name: 01163cdc54d6119b4189dc3ca98e90372b1fb731
Time: 2017-11-19
Author: matthias.fey@tu-dortmund.de
File Name: examples/mnist_grid.py
Class Name: Net
Method Name: forward