sklearn.datasets.make_blobs(n_samples=100, n_features=2, centers=3, cluster_std=1.0, center_box=(-10.0, 10.0), shuffle=True, random_state=None)

属性含义:

n_samples: int, optional (default=100)
The total number of points equally divided among clusters.
待生成的样本的总数。
n_features: int, optional (default=2)
The number of features for each sample.
每个样本的特征数。
centers: int or array of shape [n_centers, n_features], optional (default=3)
The number of centers to generate, or the fixed center locations.
要生成的样本中心(类别)数,或者是确定的中心点。
cluster_std: float or sequence of floats, optional (default=1.0)
The standard deviation of the clusters.
每个类别的方差,例如我们希望生成2类数据,其中一类比另一类具有更大的方差,可以将cluster_std设置为[1.0,3.0]。
center_box: pair of floats (min, max), optional (default=(-10.0, 10.0))
The bounding box for each cluster center when centers are generated at random.
shuffle: boolean, optional (default=True)
Shuffle the samples.
random_state: int, RandomState instance or None, optional (default=None)
If int, random_state is the seed used by the random number generator; If
RandomState instance, random_state is the random number generator; If
None, the random number generator is the RandomState instance used by
np.random.

返回值

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.
样本数据集的标签。

from sklearn.datasets import make_blobs
import matplotlib.pyplot as plt if __name__ == '__main__':
N = 400
centers = 4
data, y = make_blobs(n_samples=N, n_features=2, centers=centers) plt.scatter(data[:, 0], data[:, 1], c=y)
plt.show()

sklearn 中 make_blobs模块使用的更多相关文章

  1. sklearn 中 make_blobs模块

    # 生成用于聚类的各向同性高斯blobsklearn.datasets.make_blobs(n_samples = 100,n_features = 2,center = 3,cluster_std ...

  2. 【集成学习】sklearn中xgboost模块的XGBClassifier函数

    # 常规参数 booster gbtree 树模型做为基分类器(默认) gbliner 线性模型做为基分类器 silent silent=0时,不输出中间过程(默认) silent=1时,输出中间过程 ...

  3. 【集成学习】sklearn中xgboost模块中plot_importance函数(绘图--特征重要性)

    直接上代码,简单 # -*- coding: utf-8 -*- """ ################################################ ...

  4. sklearn中xgboost模块中plot_importance函数(特征重要性)

    # -*- coding: utf-8 -*- """ ######################################################### ...

  5. 【集成学习】sklearn中xgboot模块中fit函数参数详解(fit model for train data)

    参数解释,后续补上. # -*- coding: utf-8 -*- """ ############################################## ...

  6. sklearn中的metrics模块中的Classification metrics

    metrics是sklearn用来做模型评估的重要模块,提供了各种评估度量,现在自己整理如下: 一.通用的用法:Common cases: predefined values 1.1 sklearn官 ...

  7. python中导入sklearn中模块提示ImportError: DLL load failed: 找不到指定的程序。

    python版本:3.7 平台:windows 10 集成环境:Anaconda3.7 64位 在jupyter notebook中导入sklearn的相关模块提示ImportError: DLL l ...

  8. sklearn中的KMeans算法

    1.聚类算法又叫做“无监督分类”,其目的是将数据划分成有意义或有用的组(或簇).这种划分可以基于我们的业务需求或建模需求来完成,也可以单纯地帮助我们探索数据的自然结构和分布. 2.KMeans算法将一 ...

  9. sklearn中的模型评估-构建评估函数

    1.介绍 有三种不同的方法来评估一个模型的预测质量: estimator的score方法:sklearn中的estimator都具有一个score方法,它提供了一个缺省的评估法则来解决问题. Scor ...

随机推荐

  1. LeetCode 209. Minimum Size Subarray Sum (最短子数组之和)

    Given an array of n positive integers and a positive integer s, find the minimal length of a contigu ...

  2. Ajax中与服务器的通信【发送请求与处理响应】

    一.发送请求 Ajax中通过XMLHttpRequest对象发送异步方式的后台请求时.通常有两种方式的请求,一种是GET请求,另一种是POST请求.发送请求一般要经过4个步骤分别是: (1)初始化XM ...

  3. iOS之 LLDB调试常用命令

    LLDB是LLVM下的调试器.Xcode从4.0开始编译器开始改用LLVM,相应的调试器也从gdb改为LLDB. 1. p 用于输出基本类型 2. po 用于输出Objective-C对象 3. ex ...

  4. iPhone X 适配解决方案

    在head里添加<meta name='viewport' content='initial-scale=1, viewport-fit=cover'> 这将导致一个页面允分利用iPhon ...

  5. C#中的异常处理(try-catch的使用)——使程序更加稳定

    使用try-catch来对代码中容易出现异常的语句进行异常捕获. try { 可能出现异常的代码: } catch { 出现异常后需要执行的代码: } 注:1.在执行过程中,如果try中的代码没有出现 ...

  6. 关于CSS3 object-position/object-fit属性的使用

    object-position/object-fit属性一般用在替换元素上. 什么叫替换元素? 不是所有元素都叫"替换元素".在CSS中,"替换元素"指的是: ...

  7. net start mongodb 服务名无效解决方案

    net start mongodb 服务名无效 或者 net start mongodb 发生错误5,拒绝访问.是因为没有用管理员权限运行cmd. 解决方案:在window中,在搜索框输入cmd后,在 ...

  8. 工具:Entity Framework Profiler

    使用方式: 1.项目中添加引用:EntityFrameworkProfiler.Appender 2.应用程序启动方法中添加下面一行代码: HibernatingRhinos.Profiler.App ...

  9. Sequence one

    Problem Description Search is important in the acm algorithm. When you want to solve a problem by us ...

  10. Max Sum Plus Plus

    A - Max Sum Plus Plus Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I6 ...