From 03c7072f6f3391cc986e161d11c325c5802879d2 Mon Sep 17 00:00:00 2001 From: Franck Dary <franck.dary@lis-lab.fr> Date: Sat, 2 Nov 2019 20:34:44 +0100 Subject: [PATCH] Deleted unused member --- maca_common/src/programOptionsTemplates.cpp | 4 ++-- trainer/include/Trainer.hpp | 24 ++++++--------------- trainer/src/Trainer.cpp | 8 +++---- 3 files changed, 13 insertions(+), 23 deletions(-) diff --git a/maca_common/src/programOptionsTemplates.cpp b/maca_common/src/programOptionsTemplates.cpp index 99c9c66..d08163d 100644 --- a/maca_common/src/programOptionsTemplates.cpp +++ b/maca_common/src/programOptionsTemplates.cpp @@ -253,13 +253,13 @@ void launchTraining() if(ProgramParameters::devFilename.empty()) { - trainer.reset(new Trainer(transitionMachine, trainBD, trainConfig)); + trainer.reset(new Trainer(transitionMachine, trainConfig)); } else { devBD.reset(new BD(ProgramParameters::bdFilename, ProgramParameters::mcdFilename)); devConfig.reset(new Config(*devBD.get(), ProgramParameters::devFilename)); - trainer.reset(new Trainer(transitionMachine, trainBD, trainConfig, devBD.get(), devConfig.get())); + trainer.reset(new Trainer(transitionMachine, trainConfig, devConfig.get())); } trainer->train(); diff --git a/trainer/include/Trainer.hpp b/trainer/include/Trainer.hpp index 5ffe8ef..e52c2c7 100644 --- a/trainer/include/Trainer.hpp +++ b/trainer/include/Trainer.hpp @@ -5,6 +5,7 @@ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.*/ + /// @file Trainer.hpp /// @author Franck Dary /// @version 1.0 @@ -14,11 +15,10 @@ #define TRAINER__H #include "TransitionMachine.hpp" -#include "BD.hpp" #include "Config.hpp" #include "TrainInfos.hpp" -/// @brief An object capable of training a TransitionMachine given a BD initialized with training examples. +/// @brief An object capable of training a TransitionMachine given a Config initialized with training examples. class Trainer { private : @@ -48,16 +48,10 @@ class Trainer /// @brief The TransitionMachine that will be trained. TransitionMachine & tm; - /// @brief The BD initialized with training examples. - BD & trainBD; - /// @brief The configuration of the TransitionMachine while processing trainBD. + /// @brief The configuration of the TransitionMachine while processing train corpus. Config & trainConfig; - /// @brief The BD initialized with dev examples. - /// - /// Can be nullptr if dev is not used in this training. - BD * devBD; - /// @brief The configuration of the TransitionMachine while processing devBD. + /// @brief The configuration of the TransitionMachine while processing dev corpus. /// /// Can be nullptr if dev is not used in this training. Config * devConfig; @@ -100,23 +94,19 @@ class Trainer /// @brief Construct a new Trainer without a dev set. /// /// @param tm The TransitionMachine to use. - /// @param bd The BD to use. /// @param config The config to use. - Trainer(TransitionMachine & tm, BD & bd, Config & config); + Trainer(TransitionMachine & tm, Config & config); /// @brief Construct a new Trainer with a dev set. /// /// @param tm The TransitionMachine to use. - /// @param bd The BD corresponding to the training dataset. /// @param config The Config corresponding to bd. - /// @param devBD The BD corresponding to the dev dataset. - /// @param devConfig The Config corresponding to devBD. - Trainer(TransitionMachine & tm, BD & bd, Config & config, BD * devBD, Config * devConfig); + /// @param devConfig The Config corresponding to dev corpus. + Trainer(TransitionMachine & tm, Config & config, Config * devConfig); /// @brief Train the TransitionMachine one example at a time. /// /// For each epoch all the Classifier of the TransitionMachine are fed all the /// training examples, at the end of the epoch Classifier are evaluated on - /// the devBD if available, and each Classifier will be saved only if its score /// on the current epoch is its all time best.\n /// When a Classifier is saved that way, all the Dict involved are also saved. void train(); diff --git a/trainer/src/Trainer.cpp b/trainer/src/Trainer.cpp index d05667f..1c1b0b7 100644 --- a/trainer/src/Trainer.cpp +++ b/trainer/src/Trainer.cpp @@ -5,13 +5,13 @@ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.*/ + #include "Trainer.hpp" #include "util.hpp" -Trainer::Trainer(TransitionMachine & tm, BD & bd, Config & config) -: tm(tm), trainBD(bd), trainConfig(config) +Trainer::Trainer(TransitionMachine & tm, Config & config) +: tm(tm), trainConfig(config) { - this->devBD = nullptr; this->devConfig = nullptr; nbSteps = 0; @@ -21,7 +21,7 @@ Trainer::Trainer(TransitionMachine & tm, BD & bd, Config & config) pastTime = std::chrono::high_resolution_clock::now(); } -Trainer::Trainer(TransitionMachine & tm, BD & bd, Config & config, BD * devBD, Config * devConfig) : tm(tm), trainBD(bd), trainConfig(config), devBD(devBD), devConfig(devConfig) +Trainer::Trainer(TransitionMachine & tm, Config & config, Config * devConfig) : tm(tm), trainConfig(config), devConfig(devConfig) { nbSteps = 0; nbActions = 0; -- GitLab