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

k-means算法

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

  • Text
    文本显示,运用MFC实现,在C++6.0调试通过,适合初学者。(Text display, the use of MFC implementation, debugging in C++6.0, suitable for beginners.)
    2011-07-26 14:50:19下载
    积分:1
  • 最小化能量函数的几种方法
    几种最小化能量函数的方法,包括图割法、LBP等
    2022-03-04 17:37:21下载
    积分:1
  • 20061231172024
    取阈值常用的方法有:双峰法、迭代法、大津法(OTS(threshold for commonly used methods : bimodal, iteration, Tianjin (OTS. )
    2006-12-31 17:19:16下载
    积分:1
  • C# 树状 组织结构图 类似直销组织 源码
    C# 树状 组织结构图 类似直销组织 源码
    2013-10-03下载
    积分:1
  • VC_find_drive_letter_add_code_CListBox
    VC编程实现查找盘符并添加到CListBox代码VC programming to find the drive letter and add to the code CListBox (VC programming to find the drive letter and add to the code CListBox )
    2010-09-08 14:31:43下载
    积分:1
  • 平衡小车电机位置闭环控制
    说明:  可以实现平衡小车的位置闭环控制,但是平衡时间不久,需要加入速度环控制(Closed-loop control of the position of the balancing car can be realized, but the speed loop control is needed soon after the balancing time.)
    2020-06-24 09:40:07下载
    积分:1
  • 用光流法进行运动目标检测
    用光流法进行运动目标检测,用opencv2实现。基于光流场分析的运动目标检测方法,不仅包含了被观察物体的运动信息,而且携带了三维结构的丰富信息,因此它不仅可以用于运动目标检测,还可以直接应用于运动目标跟踪,能够很精确的计算出运动目标的速度,同时在摄像机存在运动的情况下也能够检测出运动目标
    2022-01-26 14:50:53下载
    积分:1
  • 天气接口
    说明:  可以输入地名查看详细天气信息,黄历事宜等(You can enter a place name to view detailed weather information)
    2020-06-18 06:00:01下载
    积分:1
  • EINT01
    PROTEUS下对LPC ARM7 的LPC2106进行仿真,这个是针对外部中断的。测试通过!(PROTEUS under the LPC2106 LPC ARM7 simulation, this is for an external interrupt. Test!)
    2020-07-02 15:20:01下载
    积分:1
  • C__4
    The only information passed from difeq to solvde is the matrix of derivatives
    2012-08-23 22:23:00下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载