Module ImportFrom alias Import alias identifier Import alias identifier Import alias identifier Import alias FunctionDef arguments args NameParam NameParam defaults body Return Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr BinOpPow BinOpSub Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr NameLoad Num decorator_list ClassDef bases body FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad body Expr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index Num Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr keyword NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Num For NameStore Call NameLoad AttributeLoad NameLoad attr body AugAssignAdd NameStore Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index NameLoad SubscriptLoad AttributeLoad NameLoad attr Index SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr TupleLoad SubscriptLoad AttributeLoad NameLoad attr Index Num SubscriptLoad AttributeLoad NameLoad attr Index Num For NameStore Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num body For NameStore Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num body Assign SubscriptStore SubscriptLoad NameLoad Index NameLoad Index NameLoad Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Num Num body Assign NameStore Num Assign NameStore Num While NameLoad body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr keyword Num For NameStore Call NameLoad AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad CompareEq AttributeLoad NameLoad attr NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index NameLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword Num Assign NameStore Call AttributeLoad NameLoad attr Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad SubscriptLoad AttributeLoad NameLoad attr Index SubscriptLoad SubscriptLoad NameLoad Index Num Index NameLoad Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore BinOpSub AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad If BoolOpAnd CompareLt NameLoad NameLoad CompareNotEq NameLoad Num body Break AugAssignAdd NameStore Num If CompareGt NameLoad NameLoad body Break Pass decorator_list FunctionDef arguments args NameParam defaults body Return TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list decorator_list
N/A __future__ division N/A numpy np N/A scipy sp N/A pylab py N/A random EuclidDistance N/A N/A x y N/A N/A N/A N/A N/A np sqrt N/A N/A np sum N/A N/A N/A N/A np array x N/A N/A np array y 2 N/A KmedoidsC N/A N/A __init__ N/A N/A self X K dist N/A EuclidDistance N/A N/A 
			each row of X is a dot
			K is the number of class you want to cluster
			dis is a function
		 N/A N/A self dist dist N/A N/A self X N/A N/A np array X N/A N/A self K N/A N/A np array K N/A N/A self N N/A N/A X shape N/A 0 N/A N/A self labels N/A N/A np zeros N/A self N dtype int N/A N/A self centroids N/A N/A np array N/A N/A random sample X K N/A N/A self J N/A N/A self calcJ N/A calcJ N/A N/A self N/A N/A N/A sum 0 N/A i N/A range N/A self N N/A N/A sum N/A N/A self dist N/A N/A self X N/A i N/A N/A self centroids N/A N/A N/A self labels N/A i N/A sum N/A distmat N/A N/A self X Y N/A N/A N/A 
		return the distance for centroids
		 N/A dm N/A N/A np zeros N/A N/A N/A X shape N/A 0 N/A N/A Y shape N/A 0 N/A i N/A range N/A N/A X shape N/A 0 N/A N/A j N/A range N/A N/A Y shape N/A 0 N/A N/A N/A N/A dm N/A i N/A j N/A N/A self dist N/A X N/A i N/A Y N/A j N/A dm N/A train N/A N/A self maxiter treshhold N/A 100 0.1 N/A N/A iter 0 N/A cJ 0 N/A True N/A N/A distmats N/A N/A self distmat N/A self X N/A self centroids N/A N/A self labels N/A N/A distmats argmin axis 1 N/A j N/A range N/A self K N/A N/A idx_j N/A N/A N/A N/A self labels j nonzero N/A distj N/A N/A self distmat N/A N/A self X N/A idx_j N/A N/A self X N/A idx_j N/A distsum N/A N/A np sum distj axis 1 N/A icenter N/A N/A distsum argmin N/A N/A N/A self centroids N/A j N/A N/A self X N/A N/A N/A idx_j N/A 0 N/A icenter N/A nJ N/A N/A self calcJ N/A cJ N/A N/A self J nJ N/A N/A self J nJ N/A N/A N/A cJ treshhold N/A iter 0 N/A N/A N/A iter 1 N/A N/A iter maxiter N/A N/A N/A N/A result N/A N/A self N/A N/A N/A N/A N/A self centroids N/A self labels N/A self J N/A N/A