28 bool ParamLoader::load(std::string filename, Parameters &par){
29 utils::FileParser fp(filename);
34 par = initialize_parameters_to_default();
41 void ParamLoader::save(std::string filename, Parameters &par){
42 utils::FileParser fp(filename);
48 void ParamLoader::loadOrSave(utils::FileParser &fp, Parameters &par){
49 fp.readOrWrite(
"n_iterations", par.n_iterations);
50 fp.readOrWrite(
"n_inner_iterations", par.n_inner_iterations);
51 fp.readOrWrite(
"n_init_samples", par.n_init_samples);
52 fp.readOrWrite(
"n_iter_relearn", par.n_iter_relearn);
53 fp.readOrWrite(
"init_method", par.init_method);
54 fp.readOrWrite(
"random_seed", par.random_seed);
55 fp.readOrWrite(
"verbose_level", par.verbose_level);
56 fp.readOrWrite(
"log_filename", par.log_filename);
57 fp.readOrWrite(
"load_save_flag", par.load_save_flag);
58 fp.readOrWrite(
"load_filename", par.load_filename);
59 fp.readOrWrite(
"save_filename", par.save_filename);
60 fp.readOrWrite(
"surr_name", par.surr_name);
61 fp.readOrWrite(
"sigma_s", par.sigma_s);
62 fp.readOrWrite(
"noise", par.noise);
63 fp.readOrWrite(
"alpha", par.alpha);
64 fp.readOrWrite(
"beta", par.beta);
68 par.sc_type = str2score(fp.read(
"sc_type").c_str());
69 par.l_type = str2learn(fp.read(
"l_type").c_str());
71 else if(fp.isWriting()){
72 fp.write(
"sc_type",score2str(par.sc_type));
73 fp.write(
"l_type", learn2str(par.l_type));
76 fp.readOrWrite(
"l_all", par.l_all);
77 fp.readOrWrite(
"epsilon", par.epsilon);
78 fp.readOrWrite(
"force_jump", par.force_jump);
80 fp.readOrWrite(
"kernel.name", par.kernel.name);
81 fp.readOrWrite(
"kernel.hp_mean", par.kernel.hp_mean);
82 fp.readOrWrite(
"kernel.hp_std", par.kernel.hp_std);
84 fp.readOrWrite(
"mean.name", par.mean.name);
85 fp.readOrWrite(
"mean.coef_mean", par.mean.coef_mean);
86 fp.readOrWrite(
"mean.coef_std", par.mean.coef_std);
88 fp.readOrWrite(
"crit_name", par.crit_name);
89 fp.readOrWrite(
"crit_params", par.crit_params);
Namespace of the library interface.
Allows to load parameters from file.