It should be fine to do directly inference_str == "TreeMaxProduct" and the same with the rest, if you prefer.