Class: Clusterer::DocumentBase

Inherits:
Hash
  • Object
show all
Includes:
DocumentSimilarity
Defined in:
lib/clusterer/document_base.rb

Direct Known Subclasses

Document, DocumentsCentroid

Instance Method Summary collapse

Methods included from DocumentSimilarity

#cosine_similarity

Instance Method Details

#vector_lengthObject



28
29
30
# File 'lib/clusterer/document_base.rb', line 28

def vector_length
  @vector_length ||= Math.sqrt(self.inject(0) {|n,y| n + y[1]*y[1]}) 
end