Tree-induced error

For any pair of categories (u,v) the tree induced error incurred by predicting the label u when the correct label is v is the tree distance between u and v. The tree distance between two nodes is defined to be the number of edges along the unique path from u to v.

In order to use the cumulative tree-induced error here we add all the the tree distances and divide them by the total number of them.