add decision_function and staged_decision_function and refactor some code