def divide_on_feature(X, feature_i, threshold):
    split_func = None
    if (isinstance(threshold, int) or isinstance(threshold, float)):
        split_func = (lambda sample: (sample[feature_i] >= threshold))
    else:
        split_func = (lambda sample: (sample[feature_i] == threshold))
    X_1 = np.array([sample for sample in X if split_func(sample)])
    X_2 = np.array([sample for sample in X if (not split_func(sample))])
    return np.array([X_1, X_2])
def divide_on_feature(X, feature_i, threshold):
    split_func = None
    if (isinstance(threshold, int) or isinstance(threshold, float)):
        split_func = (lambda sample: (sample[feature_i] >= threshold))
    else:
        split_func = (lambda sample: (sample[feature_i] == threshold))
    X_1 = np.array([sample for sample in X if split_func(sample)])
    X_2 = np.array([sample for sample in X if (not split_func(sample))])
    return np.array([X_1, X_2])