Skip to content
Snippets Groups Projects
Commit 03c7072f authored by Franck Dary's avatar Franck Dary
Browse files

Deleted unused member

parent 43138607
No related branches found
No related tags found
No related merge requests found
......@@ -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();
......
......@@ -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();
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment