[Spark-3525] Adding gradient boosting

@mengxr Would it be better if cache input explicitly as it is used many times inside this function?