Recommendations and Ranking

Match topic directions

BOTIE

Take their dot product and divide by the product of their lengths.
Ready to test
0 passed · 0 failed · 2 not run

An empty floor. Start with the information your machine needs.

Received result

Your answer will arrive here.

Examples, experiments and workspace controls
Live values

Connect a tool's inputs to see what it produces. You can try a branch before connecting it to Result.

Try your own inputs

Use a copy of the example to try your own data. Keep the problem's assumptions in mind, and predict the effect of a change before checking the output. You can also add another branch to compare two ways of doing the calculation.

Start at an output arrow, then click or drag to an input. Drag empty space to pan. Delete removes a selection. Ctrl/Cmd+Z undoes a change.
Context for this challenge

Take their dot product and divide by the product of their lengths.

Botie has a reader topic vector and a guide description vector. Topic direction should determine their match independently of vector length.

Calculate their dot product and divide by the product of their lengths.

Examples and results
Reader topic vector
  1. 01
  2. 10
Guide topic vector
  1. 03
  2. 10
Required result
1
Reader topic vector
  1. 02
  2. 11
Guide topic vector
  1. 01
  2. 12
Required result
0.8
Try a fresh construction

This clears this draft, including its undo history. Earlier successful attempts stay recorded. Build again without opening hints to record an independent attempt.

Stuck? Inspect a worked construction

The tools below form one possible solution. You can assemble it, follow its signals, and undo that change to return to your own construction.

Assumptions and test precision

Requires nonzero vectors with matching feature meanings. A score is not a calibrated probability. Numerical tests allow a difference of 0.001. Lists and structures must also have the right shape.

A longer feature vector points the same way

This check uses the pieces from “Compare reader and guide topic directions”.

BOTIE

Botie's reader profile and an article's feature vector have different magnitudes but the same proportions across three topics. Calculate their cosine similarity.
Reader topic vector
  1. 01
  2. 12
  3. 22
Guide topic vector
  1. 03
  2. 16
  3. 26

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.

Which assumption about coordinate meanings is needed before these two vectors can be compared?

A cosine score needs shared feature meanings and is not a calibrated probability of interest.

Requires nonzero vectors with matching feature meanings. A score is not a calibrated probability.

Work through the Python challenges →
Continue the courseLearning From Readers With Similar Preferences →