Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
andreygetmanov committed Mar 6, 2023
1 parent d825d2d commit fa9db71
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fedot/core/data/merge/data_merger.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,10 @@ def merge_predicts(self, predicts: List[np.array]) -> np.array:
if any(len(pred.shape) > 2 for pred in predicts):
raise ValueError('Merge of arrays with more than 2 dimensions is not supported')
if len(predicts) > 1:
predicts = [predict.astype(str) for predict in predicts]
result = predicts[0]
for i in range(1, len(predicts)):
result += ' ' + predicts[i]
result = np.core.defchararray.add(result, predicts[i])
return result
return predicts[0]

Expand Down
2 changes: 2 additions & 0 deletions test/unit/data/test_data_merge_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ def generate_output_texts(length=10, num_columns=1):
return OutputData(idx, task, data_type, features=features, predict=features, target=None)


# len(params) is a number of input arrays, each element of params - number of columns in the corresponding array
# FEDOT supports merging of text data with 1 column only, so ValueError is expected for (2, 1) and (2, 3, 1) cases
@pytest.fixture(params=[(1,), (1, 1), (1, 1, 1), (2, 1), (2, 3, 1)],
ids=lambda cols: f'texts with {cols} columns')
def output_texts(request):
Expand Down

0 comments on commit fa9db71

Please sign in to comment.