Module ImportFrom alias ImportFrom alias alias ImportFrom alias Import alias identifier Import alias identifier ClassDef bases body Expr Str Assign NameStore NameLoad FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str If BoolOpOr UnaryOpNot Call NameLoad NameLoad AttributeLoad NameLoad attr UnaryOpNot Call NameLoad NameLoad AttributeLoad NameLoad attr body Raise Call NameLoad Str If BoolOpOr CompareIsNot AttributeLoad NameLoad attr Num CompareIsNot AttributeLoad NameLoad attr Num body Raise Call NameLoad Str If CompareNotEq AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Raise Call NameLoad Str Pass decorator_list NameLoad decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad NameLoad Assign TupleStore NameStore NameStore TupleLoad Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr NameLoad Assign TupleStore NameStore NameStore TupleLoad ListComp BinOpSub NameLoad NameLoad comprehension NameStore SubscriptLoad NameLoad Index Num ListComp BinOpSub NameLoad NameLoad comprehension NameStore SubscriptLoad NameLoad Index Num Assign TupleStore NameStore NameStore TupleLoad Call NameLoad Call NameLoad ListComp Call NameLoad NameLoad Num comprehension NameStore NameLoad Call NameLoad Call NameLoad ListComp Call NameLoad NameLoad Num comprehension NameStore NameLoad If CompareEq BinOpMult NameLoad NameLoad Num body Return Num Return BinOpDiv UnaryOpUSub Call NameLoad Lambda arguments args NameParam NameParam defaults BinOpAdd NameLoad NameLoad ListComp BinOpMult NameLoad NameLoad comprehension TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad BinOpMult NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Num For NameStore SubscriptLoad NameLoad Index Num body If CompareNotEq NameLoad Num body AugAssignAdd NameStore Num If CompareEq NameLoad Num body Return Num Return BinOpDiv Call AttributeLoad NameLoad attr NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore BinOpMult Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr NameLoad If CompareEq NameLoad Num body Return Num Return BinOpDiv UnaryOpUSub NameLoad NameLoad decorator_list decorator_list
N/A math sqrt abc ABCMeta abstractmethod error_wrongvec WrongVecError N/A numpy np N/A numpy.linalg linalg Distance N/A N/A N/A 
    abstract class, represent distance of two vector
    
    Attributes:
     N/A __metaclass__ ABCMeta distance N/A N/A self vec1 vec2 N/A N/A N/A 
    Compute distance of two vector(one line numpy array)
    if you use scipy to store the sparse matrix, please use s.getrow(line_num).toarray() build the one dimensional array
    
    Args:
        vec1: the first line vector, an instance of array
        vec2: the second line vector, an instance of array
      
    Returns:
        the computed distance
    
    Raises:
        TypeError: if vec1 or vec2 is not numpy.ndarray and one line array
     N/A N/A N/A N/A isinstance vec1 N/A np ndarray N/A N/A isinstance vec2 N/A np ndarray N/A N/A N/A TypeError type of vec1 or vec2 is not numpy.ndarray N/A N/A N/A N/A vec1 ndim 1 N/A N/A vec2 ndim 1 N/A N/A N/A WrongVecError vec1 or vec2 is not one line array N/A N/A N/A vec1 size N/A vec2 size N/A N/A N/A WrongVecError vec1 or vec2 is not same size N/A N/A abstractmethod N/A PearsonDistance N/A Distance N/A N/A 
  pearson distance
      
  a sub class of Distance
   distance N/A N/A self vec1 vec2 N/A N/A N/A 
    Compute distance of two vector by pearson distance
     N/A N/A N/A N/A super PearsonDistance self distance vec1 vec2 N/A N/A avg1 avg2 N/A N/A N/A self _avg vec1 N/A N/A self _avg vec2 N/A N/A v1 v2 N/A N/A N/A item avg1 N/A item N/A vec1 N/A 0 N/A N/A item avg1 N/A item N/A vec2 N/A 0 N/A N/A sqrt1 sqrt2 N/A N/A sqrt N/A sum N/A N/A pow item 2 N/A item v1 N/A sqrt N/A sum N/A N/A pow item 2 N/A item v2 N/A N/A N/A sqrt1 sqrt2 0 N/A N/A 1 N/A N/A N/A N/A reduce N/A N/A N/A n m N/A N/A n m N/A N/A i j N/A N/A i j N/A zip v1 v2 N/A sqrt1 sqrt2 N/A _avg N/A N/A self vec N/A N/A N/A 
    Compute average of a vector, just compute non-zero numbers
        
    Args:
        vec: a line vector, an instance of array
          
    Returns:
        the average of the vector
     N/A size 0.0 N/A i N/A vec N/A 0 N/A N/A N/A i 0 N/A N/A size 1 N/A N/A size 0 N/A N/A 0 N/A N/A N/A N/A vec sum size N/A N/A ConsineDistance N/A Distance N/A N/A 
  consine distance
      
  a sub class of Distance
   distance N/A N/A self vec1 vec2 N/A N/A N/A 
    Compute distance of two vector by consine distance
     N/A N/A N/A N/A super ConsineDistance self distance vec1 vec2 N/A num N/A N/A np dot vec1 vec2 N/A denom N/A N/A N/A linalg norm vec1 N/A N/A linalg norm vec2 N/A N/A num 0 N/A N/A 1 N/A N/A N/A num denom N/A N/A