implemented the cost and prediction functions for softmax regression