implement bagging meta algorithm