Verify() function

I am trying to use the np.linalg.norm() function within the verify() function in week 4 assignment 1 exercise 2. Right now I have

dist = np.linalg.norm(float(identity), encoding)

and I’m getting the error “could not convert string to float: ‘bertrand’”. I think this is because ‘identity’ is a dictionary and it is using the string part of the dictionary instead of the corresponding float values of the dictionary.

My question is, how do I pass the dictionary into the function as a float instead of a string?

Ok I realized that I should have been using the database dictionary instead of the identity list of strings. I am now getting the error:

“The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()”

I get that dist is an array of distances of the values in the database dictionary and the given encoding value, but I’m not exactly sure how I’m supposed to use the if statements to return the name of the person whose dist value is less than 0.7

It seems logical to, instead of using the if statement to find a distance value less than 0.7, to instead find the minimum distance value in the dist array

I figured it out, for anyone wondering, the np.linalg.norm() function only takes one parameter, as it doesn’t compute the difference between database[identity] and ‘encoding’. I still don’t understand exactly the “distance” that it computes, however and how this “distance” is different that the difference between database[identity] and ‘encoding’, if anyone can explain that.

Did you use dist = np.linalg.norm(tf.subtract(encoding, database)) to compute distance?!
Because I wrote this but it didn’t worked!

database is a dictionary use database[identity] to get encoding of identity

Found the answer here: Error in verify()