implementation fo endoPredict