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

k-means算法

于 2022-01-26 发布 文件大小:64.35 kB
0 86
下载积分: 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 个回复

  • USB_ULPI_HS
    stm32f4 高速USB驱动,可实现高速,全速及低速模式。(stm32f4 Speed ​ ​ USB drive, enabling high-speed, full-speed and low-speed mode.)
    2013-07-23 15:16:30下载
    积分:1
  • Digital-singal-processing
    上传的文件是《数字信号处理理论、算法与实现》(第三版 胡广书著)配套光盘代码 即40个分别用FORTRAN 和C 语言编写的信号处理子程序 比如说经典功率谱估计 参数模型化功率谱估计 维纳滤波器 自适应滤波器 等经典算法( File upload digital signal processing theory, algorithms and implementation (third edition of the book with Hu Guang) supporting the CD code or 40, respectively, in FORTRAN and C language subroutines for example, the classic signal processing power spectrum estimation of the power spectral parameters of the model Wiener filter estimate adaptive filter algorithm classic )
    2015-01-22 21:22:01下载
    积分:1
  • Bullet и Weapon
    platform, and is designed to: - obfuscated scripts and libraries; ...
    2019-01-28 03:30:17下载
    积分:1
  • GDAL-Develop-Doc
    共享资料,GDAL使用手册,包括常用API说明。(Share Document, GDAL manual, including common API instructions.)
    2013-11-28 15:16:29下载
    积分:1
  • C#串口下载烧写bin文件
    C#下载bin文件在下位机上运行!!!!!!!!!!!!!!!!(C# downloads the bin file and runs on the lower computer!)
    2021-02-03 17:29:58下载
    积分:1
  • 时钟系统&&定时器
    认识时钟系统和定时器的作用和如何去运用。(Understand the function of clock system and timer and how to use it.)
    2017-11-11 13:36:06下载
    积分:1
  • TEST22[IRD]
    PIC16F886控制红外线程序,希望对大家有帮助。(PIC16F886 to control IR program, we hope to help. )
    2012-02-13 12:55:25下载
    积分:1
  • am335x
    测试am335xgpio功能,gpio驱动(Test am335xgpio function, GPIO driver)
    2020-06-21 06:40:02下载
    积分:1
  • 太阳能电池板充放电控制器 电路图
    完整太阳能充放电全套资料,性价比最高,质量优,量产资料包。(Complete solar charge and discharge complete set of data, the highest cost performance, excellent quality, production data package.)
    2021-04-22 17:08:49下载
    积分:1
  • MATLAB7[1].04
    一个关于matlab的课件,西安电子科大的,共享下(A courseware on matlab, Xi' an Electronic Science and Technology, and to share the)
    2011-09-28 11:08:25下载
    积分:1
  • 696518资源总数
  • 105559会员总数
  • 1今日下载