sklearn 抽样
1 交叉验证包中的train_test_split设置测试集比例,在原始数据中随机采样,但是所得样本中各个类别比例保持与原样本一致。如下例所示import numpy as npdata_x=[['this is class 1 ']]*100 + [['this is class 2']]*50data_y=[[1]]*100 + [[2]]*50data_yX_train, X_test,