Create an array of input documents.
Create a bag-of-words model from the input documents.
bag =
bagOfWords with properties:
Counts: [6x17 double]
Vocabulary: [1x17 string]
NumWords: 17
NumDocuments: 6
Create an array of query documents.
queries =
2x1 tokenizedDocument:
8 tokens: a brown fox leaped over the lazy dog
6 tokens: another fox leaped over the dog
Calculate the MMR scores. The output is a sparse matrix.
Visualize the MMR scores in a heat map.
Now calculate the scores again, and set the lambda value to 0.01. When the lambda value is close to 0, redundant documents yield lower scores and diverse (but less query-relevant) documents yield higher scores.
Visualize the MMR scores in a heat map.
Finally, calculate the scores again and set the lambda value to 1. When the lambda value is 1, the query-relevant documents yield higher scores despite other documents yielding high scores.
Visualize the MMR scores in a heat map.