GeneralizedVector¶
-
class
matchup.models.algorithms.generalized_vector.
GeneralizedVector
¶ Bases:
matchup.models.model.IterModel
Class that implements the ‘run’ method of Generalized Vector IR model.
Methods Summary
generalized_calculate
(doc, query)Calculate the similarity based on cosine of two vectors: doc vector and query vector. generalized_doc_repr
(term_repr, …)Generate vectors for all documents. generalized_query_repr
(query_weight, float], …)Generate query vector. run
(query, vocabulary)Run generalized vector model. term_repr
(minterms)Generate vectors for all terms based in minterms. Methods Documentation
-
classmethod
generalized_calculate
(doc: List[float], query: List[float]) → float¶ - Calculate the similarity based on cosine of two vectors: doc vector and query vector.
Parameters: - doc – doc vector
- query – query vector
Returns: score of doc
-
generalized_doc_repr
(term_repr: DefaultDict[str, List[float]], base_len: int) → DefaultDict[str, List[float]]¶ - Generate vectors for all documents.
Parameters: - term_repr – vector of all keys
- base_len – len of these vectors
Returns: All document representations
-
classmethod
generalized_query_repr
(query_weight: DefaultDict[str, float], term_repr: DefaultDict[str, List[float]], base_len: int) → List[float]¶ - Generate query vector.
Parameters: - query_weight – query weighting based in keys.
- term_repr – term vectors
- base_len – base len of term vectors
Returns:
-
run
(query: List[matchup.presentation.text.Term], vocabulary: matchup.structure.vocabulary.Vocabulary) → List[matchup.structure.solution.Result]¶ - Run generalized vector model.
Parameters: - query – List of terms.
- vocabulary – Vocabulary with a collection.
Returns: Query results
-
classmethod
term_repr
(minterms: List[matchup.models.algorithms.generalized_vector.Minterm]) → Tuple[DefaultDict[str, List[float]], int]¶ - Generate vectors for all terms based in minterms.
Parameters: minterms – Returns:
-
classmethod