[Spark-3525] Adding gradient boosting

use while instead of for. while is faster in scala