<commit_before>//============================================================================
// Name        : Trainer.cpp
// Authors     : <NAME>
// EMail       : <EMAIL>
// Date		   : 29 jun. 2017
// Version     : V1.5
// Copyright   : This file is part of SNN_network project which is released under
//               MIT license.
//============================================================================
#include "snn/trainer/Trainer.h"
#include <cmath>
#include <random>

#ifdef _WIN32
#include <Windows.h>
#endif

#include <chrono>
#include <ctime>

namespace SNN
{

	Trainer::Trainer()
	{
		m_net = nullptr;

		m_config.nb_epochs = 50;
		m_config.step = 0.1f;
		m_config.stop_error = 0.1f;
		m_config.training_type = Steepest_descent;
		m_config.error_type = mae;

		m_error = 0.f;
		m_stop = 0.f;
	}

	Trainer::~Trainer()
	{

	}

	void Trainer::train(Network* net, Matrix<float>& P, Matrix<float>& T)
	{
		m_net = net;

		if (can_be_train(P, T))
		{
			//create local training data
			Matrix<float>single_P = Matrix<float>(P.get_row_count(), 1);
			Matrix<float>single_T = Matrix<float>(T.get_row_count(), 1);

			//init all training
			init_train(P, T);
			
			//create local variables
			unsigned int vect_size = P.get_col_count();
			int m_current_layer;
			unsigned int m_current_id;
			ptr_perceptrons = m_net->m_perceptrons;
			unsigned int m_nb_layer = ptr_perceptrons.size() - 1;
			vector<Trainig_process*> empty_process;	

			bool small_error = false;
			for (unsigned int nb_epochs = 0; (nb_epochs < m_config.nb_epochs) && !small_error; nb_epochs++)
			{
				time_t start, end;
				start = clock();

				randomise(P, T);
<commit_msg>don't use copy constructor<commit_after>//============================================================================
// Name        : Trainer.cpp
// Authors     : <NAME>
// EMail       : <EMAIL>
// Date		   : 29 jun. 2017
// Version     : V1.5
// Copyright   : This file is part of SNN_network project which is released under
//               MIT license.
//============================================================================
#include "snn/trainer/Trainer.h"
#include <cmath>
#include <random>

#ifdef _WIN32
#include <Windows.h>
#endif

#include <chrono>
#include <ctime>

namespace SNN
{

	Trainer::Trainer()
	{
		m_net = nullptr;

		m_config.nb_epochs = 50;
		m_config.step = 0.1f;
		m_config.stop_error = 0.1f;
		m_config.training_type = Steepest_descent;
		m_config.error_type = mae;

		m_error = 0.f;
		m_stop = 0.f;
	}

	Trainer::~Trainer()
	{

	}

	void Trainer::train(Network* net, Matrix<float>& P, Matrix<float>& T)
	{
		m_net = net;

		if (can_be_train(P, T))
		{
			//create local training data
			Matrix<float> single_P(P.get_row_count(), 1);
			Matrix<float> single_T(T.get_row_count(), 1);

			//init all training
			init_train(P, T);
			
			//create local variables
			unsigned int vect_size = P.get_col_count();
			int m_current_layer;
			unsigned int m_current_id;
			ptr_perceptrons = m_net->m_perceptrons;
			unsigned int m_nb_layer = ptr_perceptrons.size() - 1;
			vector<Trainig_process*> empty_process;	

			bool small_error = false;
			for (unsigned int nb_epochs = 0; (nb_epochs < m_config.nb_epochs) && !small_error; nb_epochs++)
			{
				time_t start, end;
				start = clock();

				randomise(P, T);

{'fraction_non_alphanumeric': 0.2133535660091047, 'fraction_numerical': 0.013353566009104704, 'mean_word_length': 3.5027322404371586, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4863894', 'n_tokens_mistral': 1336, 'n_tokens_neox': 1164, 'n_words': 261}