sklearn --make_moons

*#1. 参数

A simple toy dataset to visualize clustering and classification algorithms. Read more in the User Guide.

Parameters
n_samples:  int or two-element tuple, optional (default=100)
If int, the total number of points generated. If two-element tuple, number of points in each of two moons.

shuffle: bool, optional (default=True)
Whether to shuffle the samples.

noise: double or None (default=None)
Standard deviation of Gaussian noise added to the data.

random_state:  int, RandomState instance, default=None
Determines random number generation for dataset shuffling and noise. Pass an int for reproducible output across multiple function calls. See Glossary.

Returns
Xarray of shape [n_samples, 2]
The generated samples.

yarray of shape [n_samples]
The integer labels (0 or 1) for class membership of each sample.
  1. 参数说明
    n_samples : 样本数,默认100个
    shuffle:是否随机打乱, 默认true
    noise: double 是否添加噪音
    random_state: 随机种子,给个int, 每次产生相同随机数。
返回:   X : [样本数, 2]
              y:[样本数], 0,1
  
example:
import numpy as np
from sklearn.datasets import make_moons
import matplotlib.pyplot as plt
# 手动生成一个随机的平面点分布,并画出来
np.random.seed(0)
X, y = make_moons(200, noise=0.50)
plt.scatter(X[:,0], X[:,1], s=10, c=y, cmap=plt.cm.Spectral)
plt.show()


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值