Unfortunately, this would not make a good substitute. Sweet potato is exactly as it sounds, sweet. A yam is dry and starchy. Therefore, it would completely change the recipe's taste; in my opinion, it would not be a change for the better.