make_hastie_10_2#
- sklearn.datasets.make_hastie_10_2(n_samples=12000, *, random_state=None)[源代码]#
生成Hastie et al. 2009,Example 10.2中使用的二进制分类数据。
十个特征是标准独立高斯和目标
y
定义如下::y[i] = 1 if np.sum(X[i] ** 2) > 9.34 else -1
阅读更多的 User Guide .
- 参数:
- n_samplesint,默认=12000
样本数量。
- random_stateint,RandomState实例或无,默认=无
确定创建数据集的随机数生成。传递int以获得跨多个函数调用的可重复输出。看到 Glossary .
- 返回:
- Xndarray of shape (n_samples, 10)
输入样本。
- y形状的nd数组(n_samples,)
输出值。
参见
make_gaussian_quantiles
这种数据集方法的概括。
引用
[1]T.哈斯蒂河Tibshirani和J. Friedman,“统计学习要素第2版”,Springer,2009年。
示例
>>> from sklearn.datasets import make_hastie_10_2 >>> X, y = make_hastie_10_2(n_samples=24000, random_state=42) >>> X.shape (24000, 10) >>> y.shape (24000,) >>> list(y[:5]) [np.float64(-1.0), np.float64(1.0), np.float64(-1.0), np.float64(1.0), np.float64(-1.0)]