make_hastie_10_2#

sklearn.datasets.make_hastie_10_2(n_samples=12000, *, random_state=None)[source]#

生成 Hastie et al. 2009, Example 10.2 中使用的二元分类数据。

这十个特征是标准的独立高斯分布,目标变量 y 定义为

y[i] = 1 if np.sum(X[i] ** 2) > 9.34 else -1

用户指南中阅读更多内容。

参数:
n_samplesint, default=12000

样本数。

random_stateint, RandomState instance or None, default=None

确定数据集创建的随机数生成。传递一个 int 值以在多次函数调用中获得可重现的输出。请参阅词汇表

返回:
Xshape 为 (n_samples, 10) 的 ndarray

输入样本。

yndarray of shape (n_samples,)

输出值。

另请参阅

make_gaussian_quantiles

这种数据集方法的泛化。

References

[1]

T. Hastie, R. Tibshirani and J. Friedman, “Elements of Statistical Learning Ed. 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)]