In real life it should be pretty close to linear, but it would be worth checking as I could imagine there being non-linearity or time dependence of a spring under what is probably a decent amount of load being applied quickly and repeatedly.
You could "linearise" an electromagnet with distance sensors and code, but that's a bit of a Franken-Solution - not least because any delay in the closed loop could make the system unstable.
In this case a couple of minutes of research - or maybe asking a physicist - would have saved a lot of essentially rather pointless tinkering.
I mean - if you enjoy tinkering more than you enjoy producing an elegant solution, then tinker away. But this is noodling around for the sake of it, not solid engineering.
For small separations, the exact geometry of the magnets starts to matter. http://www.magnetsales.com/design/faqs_frames/FAQs_2.htm has some experimental results that show the field going up a bit over 3x when distance drops from 1 to 0.5, then ~2x when going to 0.25, then ~1.5x when going to 0.125 and only changingby 1/8 when going to 0.063... all distances in inches from _surface_ for a magnet that's radius 0.5 and length 0.5 in the same units. Note that this means that the distances from the _center_ are approaching 0.5.
All that said, the force is almost certainly not exponential, I would guess.