当前位置:网站首页>sklearn.datasets.make_circles
sklearn.datasets.make_circles
2022-08-10 22:54:00 【xiaozheng123121】
目录
sklearn.datasets.make_circles(n_samples = 100,shuffle = True,noise = None,random_state = None,factor = 0.8)
作用:在 2d 中创建一个包含较小圆的大圆的样本集。
from sklearn.datasets import make_circles
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
X, y = make_circles(n_samples=1_000, factor=0.3, noise=0.05, random_state=0)
X_train, X_test, y_train, y_test = train_test_split(X, y, stratify=y, random_state=0)
_, (train_ax, test_ax) = plt.subplots(ncols=2, sharex=True, sharey=True, figsize=(8, 4))
train_ax.scatter(X_train[:, 0], X_train[:, 1], c=y_train)
train_ax.set_ylabel("Feature #1")
train_ax.set_xlabel("Feature #0")
train_ax.set_title("Training data")
test_ax.scatter(X_test[:, 0], X_test[:, 1], c=y_test)
test_ax.set_xlabel("Feature #0")
_ = test_ax.set_title("Testing data")
plt.show()
一个简单的玩具数据集,用于可视化聚类和分类算法。
参数:
n_samples : int,optional(默认值= 100)
# 生成的总点数。如果是奇数,则内圆将比外圆具有一个点。
shuffle : bool,optional(默认值= True)
# 是否洗牌样品。
noise: 双倍或无(默认=无)
# 高斯噪声的标准偏差加到数据上。
random_state : int,RandomState实例或None(默认)
# 确定数据集重排和噪声的随机数生成。传递一个int,用于跨多个函数调用的可重现输出。见术语表。
factor : 0 <double <1(默认值= .8)
# 内圈和外圈之间的比例因子。
返回值:
X : 形状数组 [n_samples,2] 生成的样本。
y : 形状数组[n_samples]
每个样本的类成员资格的整数标签(0 或 1)。
参考资料
[1] 官方链接;
边栏推荐
- This visual tool artifact is more intuitive and easy to use!love so much
- 从零开始配置 vim(7)——自动命令
- 手机端出现Z-Fighting现象
- CFdiv2-Beautiful Mirrors-(期望)
- 产品web3d效果动态展示更生动形象
- [Autumn Recruitment] [Updating ing] Hand Tear Code Series
- GoldenGate中使用 exp/imp 进行初始化
- leetcode:355. 设计推特
- CIKM2022 | Sequence Recommendation Based on Bidirectional Transformers Contrastive Learning
- 解析方法的参数列表(包含参数名称)
猜你喜欢
MySQL学习笔记(1)——基础操作
How to be a Righteous Hacker?What should you study?
MySQL: MySQL Cluster - Principle and Configuration of Master-Slave Replication
Flink(Pometheus监控)
解析方法的参数列表(包含参数名称)
Redis
How many threads does LabVIEW allocate?
【640. Solving Equations】
二叉树 | 迭代遍历 | leecode刷题笔记
Leave a message with a prize | OpenBMB x Tsinghua University NLP: The update of the large model open class is complete!
随机推荐
PyTorch官方文档学习笔记(备忘)
【MySQL】mysql因为字符集导致left join出现Using join buffer (Block Nested Loop)
带你造轮子,自定义一个随意拖拽可吸边的View
如何反弹shell
实例054:位取反、位移动
MySQL之JDBC编程增删改查
小程序制作开发应遵循哪些原则?
ArcGIS中的坐标系统和投影变换
Pytorch面试题面经
二叉树 | 代码随想录学习笔记
How does the Weiluntong touch screen display the current value of abnormal data while alarming?
音乐播放器(未完成版本)
Mysql's partial table master-slave construction and new table
企业小程序怎么开发自己的小程序?
鹏城杯 2022 web/misc writeup
DC-9靶场下载及渗透实战详细过程(DC靶场系列)
德科立科创板上市:年营收7.3亿 市值59亿
高精度乘法
实例050:随机数
《DevOps围炉夜话》- Pilot - CNCF开源DevOps项目DevStream简介 - feat. PMC成员胡涛