Deserialization
Deserialization is usually performed using an interface function which forwards to a SelectiveFactory
. Deserialization is implemented using the following two-step approach in EnsembleSVM:
-
Read the first line of the stream, which must contain the name of the class which is to be deserialized.
-
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:
-
BinaryModel::deserialize(std::istream& is)
: used to deserialize any binary model. This currently deserializes the following types:SVMModel
,SVMEnsemble
andBinaryWorkflow
. All model files, output byesvm-train
,esvm-edit
andmerge-models
will start with the name of the type. This will almost always be BinaryWorkflow. -
pipeline::deserializer<Res(Arg)>
: functor object used to deserialize anyMultistagePipe<Res(Arg)>
. Take care to always use the correct function signature for deserialization (e.g. the correct parameters forRes
andArg
).