 # cntk:edit-distance-error

```cntk:edit-distance-error(
\$prediction as cntk:variable,
\$labels as cntk:variable,
\$substitution-penalty as xs:float,
\$deletion-penalty as xs:float,
\$insertion-penalty as xs:float,
\$squash-inputs as xs:boolean,
\$tokens-to-ignore as xs:integer*,
[\$name as xs:string]
) as cntk:function```

### Summary

Edit distance error evaluation function with the option of specifying penalty of substitution, deletion and insertion, as well as squashing the input sequences and ignoring certain samples. Using the classic DP algorithm as described in https://en.wikipedia.org/wiki/Edit_distance, adjusted to take into account the penalties.

Parameters
\$prediction First input sequence.
\$labels Second input sequence.
\$substitution-penalty Substitution penalty.
\$deletion-penalty Deletion penalty.
\$insertion-penalty Insertion penalty.
\$squash-inputs Whether to merge sequences of identical samples (in both input sequences). If true and tokensToIgnore contains label ‘-‘ then given first input sequence as s1=”a-ab-” and second as s2=”-aa–abb” the edit distance will be computed against s1’ = “aab” and s2’ = “aab”.
\$tokens-to-ignore List of indices of samples to ignore during edit distance evaluation (in both sequences)
\$name The name of the Function instance in the network.

### Example

```  let \$input-variable1 := cntk:input-variable(cntk:shape((3)), "float",
fn:false(), fn:false(), "feature")
let \$input-variable2 := cntk:input-variable(cntk:shape((3)), "float",
fn:false(), fn:false(), "feature")
return cntk:edit-distance-error(\$input-variable2, \$input-variable1,
-2513.533315, -917.839638, -503.608250, fn:true(), (7304744922439162672,
-9672540140625912601))
=> cntk:function(Composite EditDistanceError (Input(Name(feature), Shape(),
Dynamic Axes([Sequence Axis(Default Dynamic Axis), Batch Axis(Default Batch
Axis)])), Input(Name(feature), Shape(), Dynamic Axes([Sequence Axis(Default
Dynamic Axis), Batch Axis(Default Batch Axis)]))))
``` Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.