add mode 2 support  and confusion matrix in mode 1