Natural Language Processing
Compare direction without rewarding length
Equal lengths with perpendicular directions
Botie's query and document term vectors can have different lengths because a document repeats more terms. A direction comparison should remove that shared size effect.
BOTIE
The inputs we are comparing
Query term vector
Example 1
- 01
- 12
Example 2
- 01
- 10
Document term vector
Example 1
- 02
- 14
Example 2
- 00
- 11
Result for example 1
1
A document covers only one of the query's directions
This check uses the pieces from “Compare term-vector directions using both lengths”.
BOTIE
- Query term vector
- 03
- 14
- Document term vector
- 03
- 10
Use a number, text, or an array matching the requested result. For a matrix, put each row in brackets. Saving your prediction runs your current construction on these inputs and checks the earlier examples too.
Build a construction in the workspace above first. This case will test those pieces.
Why does the longer copy in the first case receive the same cosine as the original direction?
Choose a similarity measure according to which changes should leave the comparison unchanged.
This is a small construction problem. The lesson explains the assumptions and the parts of the full method that this example leaves out.
Work through the Python challenges →