ValueError: Initial pipeline fit was failed due to: 'function' object has no attribute '_nodes'. Check pipeline structure and the correctness of the data
Created by: hemangjoshi37a
Traceback (most recent call last):
File "/home/hemang/anaconda3/lib/python3.8/site-packages/fedot/api/api_utils/api_composer.py", line 312, in fit_and_check_correctness
initial_pipelines[0].fit(data)
File "/home/hemang/anaconda3/lib/python3.8/site-packages/fedot/core/pipelines/pipeline.py", line 164, in fit
copied_input_data = self.preprocessor.optional_prepare_for_fit(pipeline=self,
File "/home/hemang/anaconda3/lib/python3.8/site-packages/fedot/preprocessing/preprocessing.py", line 105, in optional_prepare_for_fit
has_imputer = self.structure_analysis.check_structure_by_tag(pipeline, tag_to_check='imputation')
File "/home/hemang/anaconda3/lib/python3.8/site-packages/fedot/preprocessing/structure.py", line 47, in check_structure_by_tag
self.graph, info_df = self._enrich_with_information(node_labels)
File "/home/hemang/anaconda3/lib/python3.8/site-packages/fedot/preprocessing/structure.py", line 92, in _enrich_with_information
number_of_out_edges = self.graph.degree._nodes
AttributeError: 'function' object has no attribute '_nodes'
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
~/anaconda3/lib/python3.8/site-packages/fedot/api/api_utils/api_composer.py in fit_and_check_correctness(initial_pipelines, data, logger)
311 _, data_test = train_test_data_setup(data)
--> 312 initial_pipelines[0].fit(data)
313 initial_pipelines[0].predict(data_test)
~/anaconda3/lib/python3.8/site-packages/fedot/core/pipelines/pipeline.py in fit(self, input_data, use_fitted, time_constraint)
163 # Make additional preprocessing if it is needed
--> 164 copied_input_data = self.preprocessor.optional_prepare_for_fit(pipeline=self,
165 data=copied_input_data)
~/anaconda3/lib/python3.8/site-packages/fedot/preprocessing/preprocessing.py in optional_prepare_for_fit(self, pipeline, data)
104 # Data contains missing values
--> 105 has_imputer = self.structure_analysis.check_structure_by_tag(pipeline, tag_to_check='imputation')
106 if has_imputer is False:
~/anaconda3/lib/python3.8/site-packages/fedot/preprocessing/structure.py in check_structure_by_tag(self, pipeline, tag_to_check)
46 # Assign information for all nodes in the graph
---> 47 self.graph, info_df = self._enrich_with_information(node_labels)
48
~/anaconda3/lib/python3.8/site-packages/fedot/preprocessing/structure.py in _enrich_with_information(self, node_labels)
91 # Set names to nodes and additional info
---> 92 number_of_out_edges = self.graph.degree._nodes
93 number_of_in_edges = self.graph.in_edges._adjdict
AttributeError: 'function' object has no attribute '_nodes'
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
/tmp/ipykernel_27366/515367369.py in <module>
1 # run of the AutoML-based model generation
----> 2 pipeline = auto_model.fit(features=train_data_path, target='target')
~/anaconda3/lib/python3.8/site-packages/fedot/api/main.py in fit(self, features, target, predefined_model)
144 if self.timeout_set_in_init is not None:
145 self.api_params['timeout'] = self.timeout_set_in_init
--> 146 self.current_pipeline, self.best_models, self.history = self.api_composer.obtain_model(**self.api_params)
147
148 self._train_pipeline_on_full_dataset(recommendations, full_train_not_preprocessed)
~/anaconda3/lib/python3.8/site-packages/fedot/api/api_utils/api_composer.py in obtain_model(self, **common_dict)
69
70 # Start composing - pipeline structure search
---> 71 self.current_model, self.best_models, self.history = self.compose_fedot_model(
72 api_params=api_params_dict,
73 composer_params=composer_params_dict,
~/anaconda3/lib/python3.8/site-packages/fedot/api/api_utils/api_composer.py in compose_fedot_model(self, api_params, composer_params, tuning_params)
204 )
205
--> 206 builder = self.get_gp_composer_builder(task=api_params['task'],
207 metric_function=metric_function,
208 composer_requirements=composer_requirements,
~/anaconda3/lib/python3.8/site-packages/fedot/api/api_utils/api_composer.py in get_gp_composer_builder(self, task, metric_function, composer_requirements, optimiser, optimizer_parameters, data, logger, initial_assumption)
119 initial_pipelines = initial_assumption
120 # Check initial assumption
--> 121 fit_and_check_correctness(initial_pipelines, data, logger=logger)
122 builder = builder.with_initial_pipelines(initial_pipelines)
123 return builder
~/anaconda3/lib/python3.8/site-packages/fedot/api/api_utils/api_composer.py in fit_and_check_correctness(initial_pipelines, data, logger)
321 logger.info(fit_failed_info)
322 print(traceback.format_exc())
--> 323 raise ValueError(advice_info)
324
325
ValueError: Initial pipeline fit was failed due to: 'function' object has no attribute '_nodes'. Check pipeline structure and the correctness of the data