Browse Source

[ENH] Update tab_data_to_tuple

pull/1/head
Tony-HYX 2 years ago
parent
commit
aef5e3d490
1 changed files with 2 additions and 0 deletions
  1. +2
    -0
      abl/utils/utils.py

+ 2
- 0
abl/utils/utils.py View File

@@ -158,6 +158,8 @@ def tab_data_to_tuple(X, y, reasoning_result = 0):
'''
Convert a tabular data to a tuple by adding a dimension to each element of X and y. The tuple contains three elements: data, label, and reasoning result.
'''
if X is None:
return None
if len(X) != len(y):
raise ValueError("The length of X and y should be the same, but got {} and {}.".format(len(X), len(y)))
return ([[x] for x in X], [[y_item] for y_item in y], [reasoning_result] * len(y))

Loading…
Cancel
Save