tree based machine learning code