MCPcopy Create free account
hub / github.com/rushter/MLAlgorithms / split_dataset

Function split_dataset

mla/ensemble/base.py:53–65  ·  view source on GitHub ↗
(X, target, column, value, return_X=True)

Source from the content-addressed store, hash-verified

51
52
53def split_dataset(X, target, column, value, return_X=True):
54 left_mask, right_mask = get_split_mask(X, column, value)
55
56 left, right = {}, {}
57 for key in target.keys():
58 left[key] = target[key][left_mask]
59 right[key] = target[key][right_mask]
60
61 if return_X:
62 left_X, right_X = X[left_mask], X[right_mask]
63 return left_X, right_X, left, right
64 else:
65 return left, right

Callers 2

_find_best_splitMethod · 0.90
_trainMethod · 0.90

Calls 2

get_split_maskFunction · 0.85
keysMethod · 0.80

Tested by

no test coverage detected