{"action":"created","issue":{"url":"https://api.github.com/repos/Amber-MD/pytraj/issues/693","labels_url":"https://api.github.com/repos/Amber-MD/pytraj/issues/693/labels{/name}","comments_url":"https://api.github.com/repos/Amber-MD/pytraj/issues/693/comments","events_url":"https://api.github.com/repos/Amber-MD/pytraj/issues/693/events","html_url":"https://github.com/Amber-MD/pytraj/issues/693","id":102136357,"number":693,"title":"clustering: cpptraj vs sklearn","user":{"login":"hainm","id":4451957,"avatar_url":"https://avatars.githubusercontent.com/u/4451957?v=3","gravatar_id":"","url":"https://api.github.com/users/hainm","html_url":"https://github.com/hainm","followers_url":"https://api.github.com/users/hainm/followers","following_url":"https://api.github.com/users/hainm/following{/other_user}","gists_url":"https://api.github.com/users/hainm/gists{/gist_id}","starred_url":"https://api.github.com/users/hainm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hainm/subscriptions","organizations_url":"https://api.github.com/users/hainm/orgs","repos_url":"https://api.github.com/users/hainm/repos","events_url":"https://api.github.com/users/hainm/events{/privacy}","received_events_url":"https://api.github.com/users/hainm/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-08-20T13:15:12Z","updated_at":"2015-08-20T14:11:25Z","closed_at":"2015-08-20T13:29:52Z","body":"matched\r\n\r\n**kmeans from sklearn**\r\n```python\r\nIn [16]: from sklearn.cluster import k_means\r\n\r\nIn [17]: k_means?\r\n\r\nIn [18]: k_means(xyz, 3)\r\nOut[18]:\r\n(array([[ 14.23858333,  27.95998001,  17.09424305, ...,  16.28630257,\r\n          25.05233765,  13.6071167 ],\r\n        [ 14.5832448 ,  27.82231808,  17.40318394, ...,  16.74180794,\r\n          24.76988983,  14.1815896 ],\r\n        [ 14.65508294,  27.89365482,  18.1200428 , ...,  16.84584761,\r\n          25.13659239,  14.6453898 ]]),\r\n array([2, 2, 2, 2, 1, 1, 0, 0, 0, 0], dtype=int32),\r\n 11.786212114724094)\r\n```\r\n\r\n**kmeans from cpptraj**\r\n```\r\nIn [19]: from pytraj.cluster import kmeans\r\n\r\nIn [20]: kmeans(traj, n_clusters=3)\r\n#Clustering: 3 clusters 10 frames\r\n#Cluster 0 has average-distance-to-centroid 5.643003\r\n#Cluster 1 has average-distance-to-centroid 5.645873\r\n#Cluster 2 has average-distance-to-centroid 4.141970\r\n#DBI: 1.298084\r\n#pSF: 3.236341\r\n#Algorithm: Kmeans nclusters 3 maxit 100\r\n#Representative frames: 9 5 1\r\nOut[20]: array([2, 2, 1, 1, 1, 1, 0, 0, 0, 0], dtype=int32)\r\n```"},"comment":{"url":"https://api.github.com/repos/Amber-MD/pytraj/issues/comments/133024284","html_url":"https://github.com/Amber-MD/pytraj/issues/693#issuecomment-133024284","issue_url":"https://api.github.com/repos/Amber-MD/pytraj/issues/693","id":133024284,"user":{"login":"hainm","id":4451957,"avatar_url":"https://avatars.githubusercontent.com/u/4451957?v=3","gravatar_id":"","url":"https://api.github.com/users/hainm","html_url":"https://github.com/hainm","followers_url":"https://api.github.com/users/hainm/followers","following_url":"https://api.github.com/users/hainm/following{/other_user}","gists_url":"https://api.github.com/users/hainm/gists{/gist_id}","starred_url":"https://api.github.com/users/hainm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hainm/subscriptions","organizations_url":"https://api.github.com/users/hainm/orgs","repos_url":"https://api.github.com/users/hainm/repos","events_url":"https://api.github.com/users/hainm/events{/privacy}","received_events_url":"https://api.github.com/users/hainm/received_events","type":"User","site_admin":false},"created_at":"2015-08-20T14:11:25Z","updated_at":"2015-08-20T14:11:25Z","body":"'Stole' from mdtraj tut\r\n\r\nhttp://amber-md.github.io/pytraj/doc/build/html/tutorials/mdtraj_adapted.html"}}