May 2020
Intermediate to advanced
530 pages
17h 8m
English
The Shark-ML library has a unified API for serializing models of all kinds. Every model has the write and read methods for saving and loading model parameters, respectively. These methods take an instance of the boost::archive object as an input parameter.
Let's look at an example of model parameter serialization with the Shark-ML library. First, we generate training data for the linear regression model, as we did in the previous examples:
std::vector<RealVector> x_data(n);std::vector<RealVector> y_data(n);std::random_device rd;std::mt19937 re(rd());std::uniform_real_distribution<double> dist(-1.5, 1.5);RealVector x_v(1);RealVector y_v(1);for (size_t i = 0; i < n; ++i) { x_v(0) = i; x_data[i] = x_v; y_v(0) ...Read now
Unlock full access