机器学习中的sklearn中的聚类数据生成器

版权声明:未经同意窃取和转载我的内容,如果涉及到权益问题,后果自负! https://blog.csdn.net/weixin_41605937/article/details/84308484

参数的意思:

n_samples: int, optional (default=100)待生成的样本的总数。
n_features: int, optional (default=2)每个样本的特征数。
centers: int or array of shape [n_centers, n_features], optional (default=3)要生成的样本中心(类别)数,或者是确定的中心点。
cluster_std: float or sequence of floats, optional (default=1.0)每个类别的方差,例如我们希望生成2类数据,其中一类比另一类具有更大的方差,可以将cluster_std设置为[1.0,3.0]。
center_box: pair of floats (min, max), optional (default=(-10.0, 10.0))
shuffle: boolean, optional (default=True)
random_state:

return:

X : array of shape [n_samples, n_features]
The generated samples.
生成的样本数据集。
y : array of shape [n_samples]
The integer labels for cluster membership of each sample.

1)make_classification

sklearn.datasets.make_classification(n_samples=100, n_features=20, n_informative=2, n_redundant=2,
                    n_repeated=0, n_classes=2, n_clusters_per_class=2, weights=None,
                     flip_y=0.01, class_sep=1.0, hypercube=True,shift=0.0, scale=1.0,
                    shuffle=True, random_state=None)

通常用于分类算法。
n_features :特征个数= n_informative() + n_redundant + n_repeated
n_informative:多信息特征的个数
n_redundant:冗余信息,informative特征的随机线性组合
n_repeated :重复信息,随机提取n_informative和n_redundant 特征
n_classes:分类类别
n_clusters_per_class :某一个类别是由几个cluster构成的


样本数据集的标签。
2)make_circles and make_moons

sklearn.datasets.make_circles(n_samples=100, shuffle=True, noise=None, random_state=None, factor=0.8)

3)make_gaussian_quantiles make_hastie_10_2

sklearn.datasets.make_gaussian_quantiles(mean=None, cov=1.0, n_samples=100, n_features=2, n_classes=3,
                    shuffle=True, random_state=None)

猜你喜欢

转载自blog.csdn.net/weixin_41605937/article/details/84308484