def split_data(self, X, y, i):
sub_dict = {}
unique_val = np.unique(X[:, i])
c = range(i) + range(i + 1, X.shape[1])
for val in unique_val:
indice = np.where(X[:, i] == val)[0]
# print indice.shape
sub_dict[val] = (X[np.ix_(indice, c)], y[indice])
return sub_dict # sub_data, sub_target
评论列表
文章目录