• This repository has been archived on 05/Apr/2022
  • Stars
    star
    119
  • Rank 297,930 (Top 6 %)
  • Language
    Python
  • Created over 8 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

[Unmaintained] The Python implementation of k-medoids.

kmedoids

The Python implementation of k-medoids.

Example

from sklearn.metrics.pairwise import pairwise_distances
import numpy as np

import kmedoids

# 3 points in dataset
data = np.array([[1,1], 
                [2,2], 
                [10,10]])

# distance matrix
D = pairwise_distances(data, metric='euclidean')

# split into 2 clusters
M, C = kmedoids.kMedoids(D, 2)

print('medoids:')
for point_idx in M:
    print( data[point_idx] )

print('')
print('clustering result:')
for label in C:
    for point_idx in C[label]:
        print('label {0}: {1}'.format(label, data[point_idx]))

Output:

medoids:
[1 1]
[10 10]

clustering result:
label 0: [1 1]
label 0: [2 2]
label 1: [10 10]

License

This code is from:

Bauckhage C. Numpy/scipy Recipes for Data Science: k-Medoids Clustering[R]. Technical Report, University of Bonn, 2015.

Please cite the article if the code is used in your research.

More Repositories

1

TextRank4ZH

🌳从中文文本中自动提取关键词和摘要
Python
3,067
star
2

Pinyin2Hanzi

拼音转汉字, 拼音输入法引擎, pin yin -> 拼音
Python
552
star
3

huno

A responsible theme for Hexo
CSS
495
star
4

another-tutorial-about-java-web

😿 another tutorial about java web
340
star
5

tencent-open-source

腾讯开源作品整理
Python
274
star
6

how-to-load-dynamic-script

The right way to load javascript files dynamically.
HTML
217
star
7

ChineseTone

[本项目不再维护] 将汉字转换为拼音, 支持多音字,拼音 -> pin yin
Hack
204
star
8

flask-tutorial

Python Flask Web 框架入门教程
50
star
9

awesome-toc

generate awesome toc for web page
HTML
44
star
10

jianshu-site-search

简书站内搜索
Python
24
star
11

mybatis-tutorial

mybatis 入门教程
Java
16
star
12

Flask-dashboard-for-UPYUN

基于Python Flask框架的又拍云管理工具
JavaScript
16
star
13

paste-as-markdown

Paste HTML as Markdown
JavaScript
5
star
14

TPP

[Deprecated] A PHP framework
PHP
3
star
15

mini-pinyin

Get tone(pinyin) of Chinese character.
JavaScript
2
star
16

n-source

源码注释 https://github.com/tj/n
Shell
2
star
17

rq-source

源码注释 https://github.com/nvie/rq
Python
2
star
18

random-password-cli

Generate random password in cli.
JavaScript
2
star
19

center-text

Center the output in terminal.
Shell
1
star
20

terminal-text-width

Get the number of columns occupied by specified text in terminal.
JavaScript
1
star
21

pocha-demos

pocha is python's mocha.
Python
1
star
22

lyric-player

Play lyric in terminal.
JavaScript
1
star
23

p

PS1 management
Python
1
star
24

Timestamp-Workflow

Alfred Workflow 时间戳转换
Python
1
star
25

wxapp-find-pinyin

微信小程序:查拼音
JavaScript
1
star