Predict function implemented