aimclub / FEDOT

Automated modeling and machine learning framework FEDOT
https://fedot.readthedocs.io
BSD 3-Clause "New" or "Revised" License
635 stars 86 forks source link

Bug with replacement 'n_jobs' values in nodes #1096

Open aPovidlo opened 1 year ago

aPovidlo commented 1 year ago

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') # 
valer1435 commented 1 year ago

Актуально?