GEGELATI
|
Namespace containing the functions for filling an instance of the Learn::LearningParameters class from a Json file. More...
Functions | |
void | loadParametersFromJson (const char *path, Learn::LearningParameters ¶ms) |
Loads a given json file and fills the parameters it contains in given LearningParameters. More... | |
void | writeParametersToJson (const char *path, const Learn::LearningParameters ¶ms) |
Write the LearningParameters given as arguments into the file at the given path, using the JSON format. | |
void | setParameterFromString (Learn::LearningParameters ¶ms, const std::string ¶m, Json::Value const &value) |
Given a parameter name, sets its value in given LearningParameters. More... | |
void | setAllParamsFrom (const Json::Value &root, Learn::LearningParameters ¶ms) |
Puts the parameters described in the derivative tree root in given LearningParameters. More... | |
void | readConfigFile (const char *path, Json::Value &root) |
Reads a given json file and puts the derivative tree in root. More... | |
Namespace containing the functions for filling an instance of the Learn::LearningParameters class from a Json file.
void File::ParametersParser::loadParametersFromJson | ( | const char * | path, |
Learn::LearningParameters & | params | ||
) |
Loads a given json file and fills the parameters it contains in given LearningParameters.
High level method that simply calls more complicated ones as follow :
[in] | path | path of the JSON file from which the parameters are read. |
[out] | params | the LearningParameters being updated. |
void File::ParametersParser::readConfigFile | ( | const char * | path, |
Json::Value & | root | ||
) |
Reads a given json file and puts the derivative tree in root.
Opens the file and calls the parseFromStream() method from JsonCpp which handles all the parsing of the JSON file. It eventually returns errors in a parameter, e.g. if the file does not respect JSON format. In this case, the file is simply ignored and it is logged explicitly. However, in case of JsonCpp internal errors, there can be exceptions, as described in throws.
[in] | path | path of the JSON file from which the parameters are read. |
[out] | root | JSON tree we are going to build with the file. |
std::exception | if json parser settings are not in their right formats. |
Copyright or © or Copr. IETR/INSA - Rennes (2020 - 2021) :
Karol Desnos kdesn.nosp@m.os@i.nosp@m.nsa-r.nosp@m.enne.nosp@m.s.fr (2020 - 2021) Nicolas Sourbier nsour.nosp@m.bie@.nosp@m.insa-.nosp@m.renn.nosp@m.es.fr (2020) Pierre-Yves Le Rolland-Raumer plero.nosp@m.lla@.nosp@m.insa-.nosp@m.renn.nosp@m.es.fr (2020)
GEGELATI is an open-source reinforcement learning framework for training artificial intelligence based on Tangled Program Graphs (TPGs).
This software is governed by the CeCILL-C license under French law and abiding by the rules of distribution of free software. You can use, modify and/ or redistribute the software under the terms of the CeCILL-C license as circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the software by the user in light of its specific status of free software, that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the software's suitability as regards their requirements in conditions enabling the security of their systems and/or data to be ensured and, more generally, to use and operate it in the same conditions as regards security.
The fact that you are presently reading this means that you have had knowledge of the CeCILL-C license and that you accept its terms.
void File::ParametersParser::setAllParamsFrom | ( | const Json::Value & | root, |
Learn::LearningParameters & | params | ||
) |
Puts the parameters described in the derivative tree root in given LearningParameters.
Browses the JSON tree. If the node we're looking at is a leaf, we call setParameterFromString. Otherwise, we browe its children to follow the known parameters structure.
[in] | root | JSON tree we will use to set parameters. |
[out] | params | the LearningParameters being updated. |
void File::ParametersParser::setParameterFromString | ( | Learn::LearningParameters & | params, |
const std::string & | param, | ||
Json::Value const & | value | ||
) |
Given a parameter name, sets its value in given LearningParameters.
To find the right parameter, the method contains a lot of if statements, each of them finishing by a return. These statements compare the given parameter name to known parameters names. If a parameter is found, it casts value to the right type and sets the given parameter to this value. If no parameter was found, it simply ignores the input and logs it explicitly.
[out] | params | the learning parameters we are going to set. |
[in] | param | the name of the LearningParameters being updated. |
[in] | value | the value we want to set the parameter to. |