sethjuarez / numl

Machine Learning for .NET
http://numl.net
MIT License
430 stars 104 forks source link

KNNModel serialization #43

Closed pec92 closed 8 years ago

pec92 commented 8 years ago

Hi

when I serialize a KNNModel I get an exception on K.ToString("r"). If I change to K.ToString("d") it seems to work fine.

Could you help me, please?

'public override void WriteXml(XmlWriter writer) { writer.WriteAttributeString("K", K.ToString("d")); Xml.Write(writer, Descriptor); Xml.Write(writer, X); Xml.Write(writer, Y); }`

bdschrisk commented 8 years ago

Hey, depending on the build and platform you're running on, try using "G17" format instead of "r" or "d" to guarantee round-trips.

pec92 commented 8 years ago

Hi, thanks for the hint! I changed "d" to "G17" and it works nicely. Do I need to do a pull request or is better for me to use my local copy of numl ? (sorry for the nooby question)

bdschrisk commented 8 years ago

Use your local for now. If you can replicate in the dev branch feel free to create a pull request :)

sethjuarez commented 8 years ago

This should work now