{"id":19299244,"url":"https://github.com/yanqiangmiffy/text-cluster","last_synced_at":"2025-04-22T09:32:59.811Z","repository":{"id":139611020,"uuid":"145961591","full_name":"yanqiangmiffy/text-cluster","owner":"yanqiangmiffy","description":":dango: 文本聚类 k-means算法及实战","archived":false,"fork":false,"pushed_at":"2019-01-22T06:20:14.000Z","size":9716,"stargazers_count":54,"open_issues_count":0,"forks_count":12,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-01T22:14:56.559Z","etag":null,"topics":["k-means","k-means-clustering","kmeans-algorithm","kmeans-clustering","kmeans-clustering-algorithm"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yanqiangmiffy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-24T08:01:32.000Z","updated_at":"2024-12-06T15:41:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"d26a8f63-26f5-4305-853e-76ad30ae9add","html_url":"https://github.com/yanqiangmiffy/text-cluster","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yanqiangmiffy%2Ftext-cluster","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yanqiangmiffy%2Ftext-cluster/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yanqiangmiffy%2Ftext-cluster/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yanqiangmiffy%2Ftext-cluster/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yanqiangmiffy","download_url":"https://codeload.github.com/yanqiangmiffy/text-cluster/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250215399,"owners_count":21393792,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["k-means","k-means-clustering","kmeans-algorithm","kmeans-clustering","kmeans-clustering-algorithm"],"created_at":"2024-11-09T23:10:42.332Z","updated_at":"2025-04-22T09:32:59.804Z","avatar_url":"https://github.com/yanqiangmiffy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# text-cluster\n文本聚类\n## K-means\nK-means算法是输入聚类个数k，以及包含 n个数据对象的数据库，输出满足方差最小标准k个聚类的一种算法。\n\n**基本流程：**\n- 步骤1：\n从n个数据对象任意选择 k 个对象作为初始聚类中心；而对于所剩下其它对象，则根据它们与这些聚类中心的相似度（距离），分别将它们分配给与其最相似的\n（聚类中心所代表的）聚类；\n- 步骤2：\n再计算每个所获新聚类的聚类中心（该聚类中所有对象的均值）；\n- 步骤3：\n不断重复这一过程直到标准测度函数开始收敛为止。\n\n一般都采用均方差作为标准测度函数. k个聚类具有以下特点：各聚类本身尽可能的紧凑，而各聚类之间尽可能的分开。\n\n算法的时间复杂度上界为O(n\\*k\\*t), 其中t是迭代次数。\n\nk-means算法是一种基于样本间相似性度量的间接聚类方法，属于非监督学习方法。此算法以k为参数，把n 个对象分为k个簇，以使簇内具有较高的相似度，而且簇间的相似度较低。\n\n## 中心点的个数从3到80对应的误差值的曲线\n![](https://github.com/yanqiangmiffy/text-cluster/blob/master/assets/result.png)\n\n## 10个簇的数据集的个数\n```text\nCluster distribution:\n{3: 133, 9: 93, 1: 131, 4: 497, 5: 328, 6: 263, 8: 78, 2: 46, 0: 164, 7: 67}\n```\n## 10个类的tfidf标签结果\n```text\nTop terms per cluster:\nCluster 0 工作 人类 时间 学习 事情 员工 研究 生活 团队 能力\nCluster 1 区块 货币 比特 加密 星球 数字 交易所 交易 项目 技术\nCluster 2 公寓 房租 长租 租金 租赁 租房 房源 上涨 北京 资本\nCluster 3 手机 苹果 三星 小米 华为 科技 智能手机 厂商 发布 推出\nCluster 4 中国 特斯拉 电影 美国 明星 马斯克 谷歌 科技 产品 攻略\nCluster 5 融资 投资 企业 中国 教育 服务 平台 行业 产品 亿美元\nCluster 6 用户 品牌 平台 内容 产品 视频 电商 社交 程序 消费\nCluster 7 城市 房价 上海 房地产 房子 北京 上涨 经济 一线 数据\nCluster 8 汽车 驾驶 自动 特斯拉 生产 技术 中国 未来 亿美元 苹果\nCluster 9 腾讯 游戏 用户 玩家 中国 内容 娱乐 视频 平台 世界\n```\n## 评分\n```text\n0.8191335472911944\n``` \n## 说明\n代码大部分来自这篇文章：[K-means算法及文本聚类实践](https://blog.csdn.net/havedream_one/article/details/45146829),只是没有数据集，然后自己手撕写了个36kr文章的爬虫的程序。φ(\u003eω\u003c*) \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyanqiangmiffy%2Ftext-cluster","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyanqiangmiffy%2Ftext-cluster","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyanqiangmiffy%2Ftext-cluster/lists"}