Learning optimal decision boundaries