Skip to content
Marc Claesen edited this page Oct 11, 2013 · 9 revisions

Deserialization is usually performed using an interface function which forwards to a SelectiveFactory. Deserialization is implemented using the following two-step approach in EnsembleSVM:

  1. Read the first line of the stream, which must contain the name of the class which is to be deserialized.

  2. Forward the subsequent content of the stream to the appropriate deserialization function. Typically, we forward to the static ClassName::deserialize function.

Types that require deserialization must be registered explicitly in the correct SelectiveFactory. We provide macros for this purpose. We opted to require explicit registration to keep the code transparant. The registration of built-in types is done in include/Registration.hpp and should be self-explanatory.

The main deserialization interfaces that are currently used are:

  1. BinaryModel::deserialize(std::istream& is): used to deserialize any binary model. This currently deserializes the following types: SVMModel, SVMEnsemble and BinaryWorkflow. All model files, output by esvm-train, esvm-edit and merge-models will start with the name of the type. This will almost always be BinaryWorkflow.

  2. pipeline::deserializer<Res(Arg)>: functor object used to deserialize any MultistagePipe<Res(Arg)>. Take care to always use the correct function signature for deserialization (e.g. the correct parameters for Res and Arg).