登录
首页 » c » k-means算法

k-means算法

于 2022-01-26 发布 文件大小:64.35 kB
0 109
下载积分: 2 下载次数: 1

代码说明:

#include #include #define N 11 //代表数据点的个数 #define K 3 //代表簇的个数 typedef struct { float x; float y; }Point; //代表数据点的数据结构 int center[N];  //判断每个点属于哪个簇 Point point[N] = { {2.0, 10.0},{2.0, 5.0},{8.0, 4.0},{5.0, 8.0},{7.0, 5.0}, {6.0, 4.0},{1.0, 2.0},{4.0, 9.0},{7.0, 3.0},{1.0, 3.0}, {3.0, 9.0}}; Point mean[K];  //保存每个簇的中心点 float getDistance(Point point1, Point point2); void getMean(int center[N]); float getE(); void cluster(); int main() {     int i, j; int n = 0; //统计进行了多少次聚类     float temp1; //用于存平方误差     float temp2;     printf(" 处理的数据点集合为: ");     for(i = 0; i < N; ++i)     {  

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • Beyond-the-CPP-STL
    Boost 带领你远远地超越了C++标准库,它使得C++编程更优雅、更有活力、更高产。首先, 我们系统地介绍一下Boost 库的主要组成和它们的主要用法。(Boost lead you far beyond C++ standard library, it makes C++ programming more elegant, more dynamic, more productive. First, we introduced a major component of the Boost libraries and their usage.)
    2013-04-26 14:05:00下载
    积分:1
  • IIR巴特沃斯滤波器实现
    说明:  ccs 的iir滤波器,内含多个文件。可以尝试(IIR filter of CCS,i hope you can succeed,thanks)
    2021-01-01 20:05:09下载
    积分:1
  • StringClass
    这个代码是STRING类的声明及实现,因为我认为C++类库中的string类比较庞大,找一个函数需要很长时间,所以用一个简单明了的代替之.(STRING kind of statement and realized, because I think the C library string of relatively large, a function for a very long time. Therefore, the use of a simple and straightforward replaced it.)
    2006-05-17 17:46:58下载
    积分:1
  • AM2301
    温湿度检测 AM32101温湿度传感器 可以检测(Temperature and humidity sensor temperature and humidity testing AM32101)
    2011-07-10 20:01:46下载
    积分:1
  • VCPP
    实现对C语言的源程序的词法分析的词法分析器,词法分析器的功能就是读入字符串形式的源程序,识别出具有独立意义的最小语法单位,即单词,并对识别出的单词进行相应的产生属性字处理。(Lexical analyzer lexical analysis of the C language source code, the lexical analyzer function is to read into a string in the form of source code to identify the smallest grammatical unit has independent significance, that is the word, and identify words The generation attribute word processing.)
    2013-04-04 10:38:57下载
    积分:1
  • PayAccount
    包含员工管理,书籍管理,项目管理和分配,项目进度和薪资核算(It includes staff management, book management, project management and allocation, project progress and payroll accounting.)
    2018-11-09 16:25:09下载
    积分:1
  • f28335_closeloop3_ticcs
    说明:  f28335适用的三相逆变器的一个简单闭环程序(A Simple Closed-Loop Program for Three-Phase Inverter Applicable to f28335)
    2019-04-18 11:17:17下载
    积分:1
  • webtest
    说明:  http+json api 调试工具,方便在调试接口(http+json api debug tool)
    2020-06-24 16:00:01下载
    积分:1
  • A very good C# Written in asp.net ticket management process includes the develop...
    很不错的一个C#写的asp.net车票管理程序包含开发说明,此为转载版权归原作者仅为学习用-A very good C# Written in asp.net ticket management process includes the development shows that this belongs to original author for reproduced only learn
    2023-04-02 06:15:03下载
    积分:1
  • c++项目
    c++的一个项目,如果想研究项目,可以来学习学习,一个谷歌的开源c++库,,需要的可以进行下载
    2022-01-24 17:23:51下载
    积分:1
  • 696516资源总数
  • 106442会员总数
  • 11今日下载