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

k-means算法

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

  • Day 4
    实现了双向MMC的5000V转8000V网络。(The bidirectional MMC network from 5000V to 8000V is realized.)
    2020-06-21 16:20:01下载
    积分:1
  • gif图片转换成jpg文件格式 实例源码
    gif图片转换成jpg文件格式 实例源码
    2013-05-22下载
    积分:1
  • MFC开发的画图
    用vc++6.0开发的实现画图的功能,可以自己选择颜色,线条粗细,形状等,基于mfc单文档开发的,适合初学者研究
    2022-01-25 21:22:20下载
    积分:1
  • 遥感图像决策树分类
    能够对遥感图像进行决策树分类,并能提取出植被水体等类别,用于初学者辅助遥感分类算法的学习,所能处理的图像要现在ENVI中进行图像预处理,以TIFF格式保存。
    2022-03-24 14:28:13下载
    积分:1
  • How-to-Read-a-Paper
    IEEE fellow 教你如何阅读科技论文(IEEE fellow teach you how to read scientific paper.)
    2013-09-03 15:33:08下载
    积分:1
  • PCA
    说明:  基于c8051f120内部PCA使用的C程序。内含6个.c文件。8bitPWM,16bitPWM,高速输出,频率,软件定时,捕获。(C8051f120-based C-program used within the PCA. Containing 6. C files. 8bitPWM, 16bitPWM, high-speed output, frequency, software timing, to capture.)
    2009-08-26 17:11:05下载
    积分:1
  • 798456498496
    STC12C5A60S2芯片是宏晶51单片机的升级版,它内部自带AD/DA,本程序是以内部AD/DA实现的数模/模数转换(STC12C5A60S2 51 single crystal silicon is a macro upgraded version, it comes within the AD/DA, the procedure is within the AD/DA to achieve the number of A/D conversion)
    2011-10-29 19:26:21下载
    积分:1
  • RTKLIB-rtklib_2.4.3
    说明:  通过GPS接收机,实现动态或静态状况下的精确定位。(realize the precise position)
    2019-04-03 15:33:47下载
    积分:1
  • MicrosoftPressMicrosoftVisualCSharp2005StepbyStepO
    Microsoft Press Microsoft Visual C Sharp 2005 Step by Step Oct 2005(Microsoft Press Microsoft Visual C Sharp 2 005 Step by Step Oct 2005)
    2021-04-25 10:38:46下载
    积分:1
  • udf_whj
    用于模拟fluent中吸附脱附的case,其中吸附脱附过程的传热传质需要自己使用udf(Case for simulating adsorption and desorption in fluent, and the heat and mass transfer in the process of adsorption and desorption should be declared by UDF)
    2021-01-06 20:18:53下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载