FEDOT icon indicating copy to clipboard operation
FEDOT copied to clipboard

Bug with replacement 'n_jobs' values in nodes

Open aPovidlo opened this issue 1 year ago • 1 comments

After you created pipeline with setting specified 'n_jobs' values in params and trying to fit it, next method self.replace_n_jobs_in_nodes(n_jobs) in pipeline.fit() always change n_jobs to 1.

self.replace_n_jobs_in_nodes(n_jobs) requires to avoid nodes parallelization while fedot's composing, but in case with pipeline "handed" constructed it should work correctly. One of the possible solution is to adding a check to composition stage or fitting pipeline from builder.

To reproduce the error:

train = pd.read_csv(f'{fedot_project_root()}/cases/data/scoring/scoring_train.csv')

    input_train = InputData(
        idx=np.arange(0, len(train.target)),
        features=np.array(train.drop(['target'], axis=1)),
        target=np.array(train.target),
        task=Task(TaskTypesEnum.classification),
        data_type=DataTypesEnum.table,
    )

    params = {
        'n_jobs': -1
    }

    pipeline = PipelineBuilder() \
        .add_node(operation_type='rf', params=params) \
        .build()

    assert pipeline.nodes[0].parameters['n_jobs'] == params.get('n_jobs')

    pipeline.fit(input_train)

    assert pipeline.nodes[0].parameters['n_jobs'] == params.get('n_jobs') # 

aPovidlo avatar May 05 '23 16:05 aPovidlo

Актуально?

valer1435 avatar Sep 28 '23 09:09 valer1435