y = iris.target
# 移除前 40 个观测
X = X[40:,:]
y = y[40:]
# 创建二元目标向量,表示是否是类 0
y = np.where((y == 0), 0,..., size=n_class0, replace=False)
# 将类 0 的目标向量,和下采样的类 1 的目标向量连接到一起
np.hstack((y[i_class0], y[i_class1_...i_class0_upsampled = np.random.choice(i_class0, size=n_class1, replace=True)
# 将类 0 的上采样的目标向量,和类 1 的目标向量连接到一起...[np.nan, -0.67, -0.22]])
# 创建填充器对象
imputer = Imputer(strategy='most_frequent', axis=0)
# 使用最频繁的类别填充缺失值...X = iris.data
# 为目标数据创建标签
y = iris.target
# 随机将数据分成四个新数据集,训练特征,训练结果,测试特征,
# 和测试结果。