Learn practical skills, build real-world projects, and advance your career

Evaluate a Siamese model: Ungraded Lecture Notebook

import trax.fastmath.numpy as np
INFO:tensorflow:tokens_length=568 inputs_length=512 targets_length=114 noise_density=0.15 mean_noise_span_length=3.0

Inspecting the necessary elements

In this lecture notebook you will learn how to evaluate a Siamese model using the accuracy metric. Because there are many steps before evaluating a Siamese network (as you will see in this week's assignment) the necessary elements and variables are replicated here using real data from the assignment:

  • q1: vector with dimension (batch_size X max_length) containing first questions to compare in the test set.
  • q2: vector with dimension (batch_size X max_length) containing second questions to compare in the test set.

Notice that for each pair of vectors within a batch ([q11,q12,q13,...]([q1_1, q1_2, q1_3, ...], [q21,q22,q23,...])[q2_1, q2_2,q2_3, ...]) q1iq1_i is associated to q2kq2_k.

  • y_test: 1 if q1iq1_i and q2kq2_k are duplicates, 0 otherwise.

  • v1: output vector from the model's prediction associated with the first questions.

  • v2: output vector from the model's prediction associated with the second questions.

You can inspect each one of these variables by running the following cells: