implement tree.classify