aimclub / FEDOT

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

Bug with filter operation #999

Closed valer1435 closed 1 year ago

valer1435 commented 1 year ago

https://colab.research.google.com/drive/1MRgwB9sCrFeXRme0eGSZ0KeBRAMlnfOk?usp=sharing data: https://drive.google.com/file/d/1Msx8sUVm6jh6L-QH20aJrw47DvvKk-HM/view?usp=sharing

Exception

in run_regression_example(visualise) 22 **composer_params) 23 ---> 24 auto_model.fit(features=train, target='target') 25 prediction = auto_model.predict(features=test) 26 if visualise: /usr/local/lib/python3.8/dist-packages/fedot/api/main.py in fit(self, features, target, predefined_model) 181 # Final fit for obtained pipeline on full dataset 182 if self.history and not self.history.is_empty() or not self.current_pipeline.is_fitted: --> 183 self._train_pipeline_on_full_dataset(recommendations, full_train_not_preprocessed) 184 self.params.api_params['logger'].message('Final pipeline was fitted') 185 else: /usr/local/lib/python3.8/dist-packages/fedot/api/main.py in _train_pipeline_on_full_dataset(self, recommendations, full_train_not_preprocessed) 456 {k: v for k, v in recommendations.items() 457 if k != 'cut'}) --> 458 self.current_pipeline.fit( 459 full_train_not_preprocessed, 460 n_jobs=self.params.api_params['n_jobs'], /usr/local/lib/python3.8/dist-packages/fedot/core/pipelines/pipeline.py in fit(self, input_data, time_constraint, n_jobs) 139 140 if time_constraint is None: --> 141 train_predicted = self._fit(input_data=copied_input_data) 142 else: 143 train_predicted = self._fit_with_time_limit(input_data=copied_input_data, time=time_constraint) /usr/local/lib/python3.8/dist-packages/fedot/core/pipelines/pipeline.py in _fit(self, input_data, process_state_dict, fitted_operations) 102 with Timer() as t: 103 computation_time_update = not self.root_node.fitted_operation or self.computation_time is None --> 104 train_predicted = self.root_node.fit(input_data=input_data) 105 if computation_time_update: 106 self.computation_time = round(t.minutes_from_start, 3) /usr/local/lib/python3.8/dist-packages/fedot/core/pipelines/node.py in fit(self, input_data, **kwargs) 389 self.log.debug(f'Trying to fit secondary node with operation: {self.operation}') 390 --> 391 secondary_input = self._input_from_parents(input_data=input_data, parent_operation='fit') 392 393 return super().fit(input_data=secondary_input) /usr/local/lib/python3.8/dist-packages/fedot/core/pipelines/node.py in _input_from_parents(self, input_data, parent_operation) 429 parent_nodes = self._nodes_from_with_fixed_order() 430 --> 431 parent_results, _ = _combine_parents(parent_nodes, input_data, 432 parent_operation) 433 /usr/local/lib/python3.8/dist-packages/fedot/core/pipelines/node.py in _combine_parents(parent_nodes, input_data, parent_operation) 471 parent_results.append(prediction) 472 elif parent_operation == 'fit': --> 473 prediction = parent.fit(input_data=input_data) 474 parent_results.append(prediction) 475 else: /usr/local/lib/python3.8/dist-packages/fedot/core/pipelines/node.py in fit(self, input_data, **kwargs) 301 else: 302 self.node_data = input_data --> 303 return super().fit(input_data) 304 305 def unfit(self): /usr/local/lib/python3.8/dist-packages/fedot/core/pipelines/node.py in fit(self, input_data) 179 self.fit_time_in_seconds = round(t.seconds_from_start, 3) 180 else: --> 181 operation_predict = self.operation.predict_for_fit(fitted_operation=self.fitted_operation, 182 data=input_data, 183 params=self._parameters) /usr/local/lib/python3.8/dist-packages/fedot/core/operations/operation.py in predict_for_fit(self, fitted_operation, data, params, output_mode) 112 for example, is the operation predict probabilities or class labels 113 """ --> 114 return self._predict(fitted_operation, data, params, output_mode, is_fit_stage=True) 115 116 def _predict(self, fitted_operation, data: InputData, params: Optional[OperationParameters] = None, /usr/local/lib/python3.8/dist-packages/fedot/core/operations/operation.py in _predict(self, fitted_operation, data, params, output_mode, is_fit_stage) 122 123 if is_fit_stage: --> 124 prediction = self._eval_strategy.predict_for_fit( 125 trained_operation=fitted_operation, 126 predict_data=data) /usr/local/lib/python3.8/dist-packages/fedot/core/operations/evaluation/regression.py in predict_for_fit(self, trained_operation, predict_data) 84 :return: 85 """ ---> 86 prediction = trained_operation.transform_for_fit(predict_data) 87 converted = self._convert_to_output(prediction, predict_data) 88 return converted /usr/local/lib/python3.8/dist-packages/fedot/core/operations/evaluation/operation_implementations/data_operations/sklearn_filters.py in transform_for_fit(self, input_data) 59 mask = self.operation.inlier_mask_ 60 if mask is not None: ---> 61 input_data = update_data(input_data, mask) 62 else: 63 self.log.info("Filtering Algorithm: didn't fit correctly. Return all objects") /usr/local/lib/python3.8/dist-packages/fedot/core/operations/evaluation/operation_implementations/data_operations/sklearn_filters.py in update_data(input_data, mask) 231 old_idx = modified_input_data.idx 232 --> 233 modified_input_data.features = old_features[mask] 234 modified_input_data.target = old_target[mask] 235 modified_input_data.idx = np.array(old_idx)[mask] IndexError: boolean index did not match indexed array along dimension 0; dimension is 68 but corresponding boolean dimension is 55
valer1435 commented 1 year ago

В версии 0.6.1 не появляется. Можно закрывать