Persist/Serialize ?

Kérdés Persist/Serialize ?

  • martedì 28 febbraio 2012 18:58
     
     
    After training a model and getting a posterior distribution how do you persist or serialize it so you can use the model again in another application or session?  For example if you have a gaussian distribution you have trained what is the best way to store it? Do you just keep mean and std?

Tutte le risposte

  • venerdì 2 marzo 2012 09:05
    Proprietario
     
     

    It will depend on various things. Whether you want long or short term persistence, how efficient you want it to be, what apps you want to communicate with etc.

    You can use standard .NET serialization binary or XML serialization (http://msdn.microsoft.com/en-us/library/7ay27kt9(v=vs.71).aspx); all distributions are marked with a Serializable attribute.

    Or you can explicitly save the defining properties of the distribution; for a Gaussian, you might want to save/load the natural parameters (Precision and MeanTimesPrecision) as these are the two public fields which define the distribution, but you could equally well save mean and precision or mean and variance. You can look in the source folder in your installation to understand distribution classes.

    John

  • venerdì 22 giugno 2012 18:44
     
     

    Can I save the model as a whole, so that I don't have to build/compile the model again?

    Thanks

  • lunedì 25 giugno 2012 23:20
     
     
    Whoops, pls ignore. I think I can persist the generated dll. Thanks.
    • Modificato exx lunedì 25 giugno 2012 23:23
    •  
  • giovedì 4 ottobre 2012 10:15
     
     
    The Infer.NET user guide now has a section on serialization.