Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions medcat-v2/medcat/components/addons/meta_cat/ml_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,11 @@ def split_list_train_test(data: list, test_size: float, shuffle: bool = True
Returns:
tuple: The train data, and the test data.
"""
if shuffle:
random.shuffle(data)

X_features = [x[:-1] for x in data]
y_labels = [x[-1] for x in data]

X_train, X_test, y_train, y_test = train_test_split(
X_features, y_labels, test_size=test_size, random_state=42)
X_features, y_labels, test_size=test_size, shuffle=shuffle)

train_data = [x + [y] for x, y in zip(X_train, y_train)]
test_data = [x + [y] for x, y in zip(X_test, y_test)]
Expand Down
6 changes: 1 addition & 5 deletions v1/medcat/medcat/utils/meta_cat/ml_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,10 @@ def split_list_train_test(data: List, test_size: float, shuffle: bool = True) ->
Returns:
Tuple: The train data, and the test data.
"""
if shuffle:
random.shuffle(data)

X_features = [x[:-1] for x in data]
y_labels = [x[-1] for x in data]

X_train, X_test, y_train, y_test = train_test_split(X_features, y_labels, test_size=test_size,
random_state=42)
X_train, X_test, y_train, y_test = train_test_split(X_features, y_labels, test_size=test_size, shuffle=shuffle)

train_data = [x + [y] for x, y in zip(X_train, y_train)]
test_data = [x + [y] for x, y in zip(X_test, y_test)]
Expand Down
Loading