How to use the suod.models.utils.utility._unfold_parallel function in suod

To help you get started, we’ve selected a few suod examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yzhao062 / SUOD / examples / temp_do_not_use.py View on Github external
delayed(_parallel_fit)(
            n_estimators_list[i],
            base_estimators[starts[i]:starts[i + 1]],
            X_train,
            n_estimators,
            rp_flags[starts[i]:starts[i + 1]],
            objective_dim,
            rp_method=rp_method,
            verbose=True)
        for i in range(n_jobs))

    print('Orig Fit time:', time.time() - start)
    print()

    all_results = list(map(list, zip(*all_results)))
    trained_estimators = _unfold_parallel(all_results[0], n_jobs)
    jl_transformers = _unfold_parallel(all_results[1], n_jobs)

    ##########################################################################
    start = time.time()
    n_estimators = len(base_estimators)
    n_estimators_list, starts, n_jobs = _partition_estimators(n_estimators,
                                                              n_jobs)
    # model prediction
    all_results_pred = Parallel(n_jobs=n_jobs, max_nbytes=None,
                                verbose=True)(
        delayed(_parallel_predict)(
            n_estimators_list[i],
            trained_estimators[starts[i]:starts[i + 1]],
            None,
            X_test,
            n_estimators,
github yzhao062 / SUOD / examples / temp_do_not_use.py View on Github external
n_estimators_list[i],
            base_estimators[starts[i]:starts[i + 1]],
            X_train,
            n_estimators,
            rp_flags[starts[i]:starts[i + 1]],
            objective_dim,
            rp_method=rp_method,
            verbose=True)
        for i in range(n_jobs))

    print('Orig Fit time:', time.time() - start)
    print()

    all_results = list(map(list, zip(*all_results)))
    trained_estimators = _unfold_parallel(all_results[0], n_jobs)
    jl_transformers = _unfold_parallel(all_results[1], n_jobs)

    ##########################################################################
    start = time.time()
    n_estimators = len(base_estimators)
    n_estimators_list, starts, n_jobs = _partition_estimators(n_estimators,
                                                              n_jobs)
    # model prediction
    all_results_pred = Parallel(n_jobs=n_jobs, max_nbytes=None,
                                verbose=True)(
        delayed(_parallel_predict)(
            n_estimators_list[i],
            trained_estimators[starts[i]:starts[i + 1]],
            None,
            X_test,
            n_estimators,
            # rp_flags[starts[i]:starts[i + 1]],