Closed schalkdaniel closed 1 year ago
Problem: Each base learner stores the data which leads to many replicated matrices in the JSON. INSTEAD: After serializing the base learner factories (that hold the unique data objects) initialize the data objects from the base learners as real pointers from the factory data objects.
This may require a more sophisticated loading method for the std::vector<blearner::Baselearner>
that gets the JSON with the base learners and a JSON with the data container or factories.
Then do something like:
Baselearner::BaselearnerXYZ (const json& jbl, const json& jdat)
: xyz ( jbl["xyz"] ),
_sh_ptr_data ( jsonToData(jdat[jbl["data_id"]] )
{ }
Actually, the list of base learner factories must be initialized first, then given to the construction which copies the required data.
Also for the base learner factories: Initialize a map with data objects first and the use in blearnerfactory::jsonToFactory(json j, std::map<std::string, std::shared_ptr<data::Data>> dmap)
to adequately copy the data by reference. The same for the base learner.