When you say swap the polarity, you are saying connect the (-) on the battery end to (+) on the UA-5 end of the cable and vice-versa?
Yup, that's basically it.
What purpose does that serve?
It will provide the UA5 with the proper polarity and allow it to work. Wrong polarity = no worky. The UA5 has (-) tip, (+) ring. Most devices have (+) tip, (-) ring. You just want to make sure the battery's (-) wire is secured to the UA5 connector's "tip" wire, and the battery's (+) wire is secured to the UA5 connector's "ring" wire. I believe the UA5 is protected against reversed polarity, so even if you get it backwards it won't damage it. BUT...I'm not 100% positive on that, so do it at your own risk! Easy way to test polarity, just use a voltmeter: connect the (+) lead to the UA5 connector's ring, and the (-) lead to the UA5 connector's tip, and you should have a positive voltage roughly equal to your battery's published voltage spec.
And what do you mean by the "stock" cable, are you talking about the wal-wart for the UA-5?
Yeah, the wallwart. Sorry I wasn't clear. I never ran my UA5 off AC, so I never needed the wallwart. For my R-4, I have 2 wallwarts - one I hacked to use for my remote power, and another stock I left alone for AC power.