Module: Clusterer::DocumentVector::InstanceMethods

Included in:
Linalg::DMatrix, Vector
Defined in:
lib/clusterer/lsi/document_vector.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#positionObject

Returns the value of attribute position.



26
27
28
# File 'lib/clusterer/lsi/document_vector.rb', line 26

def position
  @position
end

Instance Method Details

#cosine_similarity(doc) ⇒ Object



28
29
30
31
# File 'lib/clusterer/lsi/document_vector.rb', line 28

def cosine_similarity(doc)
  return 1.0 unless doc# && doc.centroid
  self.dot((doc.class == DocumentsCentroidVector ? doc.centroid : doc)) #.transpose
end