Failed modified_costs_check

For week 1 Assignment’s method - min_edit_distance , one test is falling with incorrect output… I think the code is correct not sure why only the first row is showing incorrect values :

Distance matrix has wrong values.
Expected: [[ 0 2 4 6 8 10]
[ 2 0 2 4 6 8]
[ 4 2 0 2 4 6]
[ 6 4 2 0 2 4]
[ 8 6 4 2 3 5]].
Got: [[0 1 2 3 4 5]
[1 0 2 4 6 7]
[2 2 0 2 4 6]
[3 4 2 0 2 4]
[4 6 4 2 3 5]].
15 Tests passed
1 Tests failed

Maybe take a look at this thread, which is reporting both the same issue and a fix…

Thanks for sharing the topic. However, I am still not able to figure out the issue. @David_Plon mentioned that he was not initializing the row and column 0 correctly. I think I am doing that correctly here.
for row in range(0,m+1):
D[row,0] = row
Is this wrong ?

look closely at the solution offered in the linked thread …only worked if del_cost and ins_cost were both set to 1

Suppose you had the expression

a = b * c

If you’re only getting the correct value for a when c == 1, it’s the same as if you had written

a = b

right?

Notice that in the matrix depicted in the notebook as Figure 8. Example Distance Matrix the values for 0^{th} row and column depend on the assumption insert/delete cost = 1 which isn’t explicitly represented in the algebra working out the rest of the values.