Example #1
0
void ViTrainer::clear()
{
	setNetwork(NULL);
	setLearningRate(DEFAULT_LEARNING_RATE);
	setIterationLimit(0); //Unlimited
	setErrorLimit(0);
	mCurrentIteration = -1;
	mCurrentError = 1;
	viDeleteAll(mErrorFunctions);
}
Example #2
0
bool ViTrainer::importData(ViElement element)
{
	if(element.name() != "trainer")
	{
		element = element.child("trainer");
		if(element.name() != "trainer")
		{
			return false;
		}
	}

	ViElement theName = element.child("name");
	if(theName.isNull())
	{
		return false;
	}
	if(theName.toString() != name("Trainer"))
	{
		return false;
	}

	ViElement limit = element.child("iterationlimit");
	if(limit.isNull())
	{
		LOG("The iteration limit could not be imported", QtCriticalMsg);
	}
	else
	{
		setIterationLimit(limit.toInt());
	}

	limit = element.child("errorlimit");
	if(limit.isNull())
	{
		LOG("The error limit could not be imported", QtCriticalMsg);
	}
	else
	{
		setErrorLimit(limit.toReal());
	}

	limit = element.child("learningrate");
	if(limit.isNull())
	{
		LOG("The learning could not be imported", QtCriticalMsg);
	}
	else
	{
		setLearningRate(limit.toReal());
	}

	addErrorFunction(ViErrorFunctionManager::create(element));

	return true;
}
Example #3
0
void ListModel::applyParams(SolverParams &params) {
	LOG_I("Applying custom parameters");
	if (ls.getNbPhases() == 0) {
		auto phase = ls.createPhase();
		if(params.iterLimit != -1)
			phase.setIterationLimit(static_cast<long long>(params.iterLimit));
		if(params.timeLimit != -1.0)
			phase.setTimeLimit(static_cast<int>(params.timeLimit));
		auto param = ls.getParam();
		param.setNbThreads(params.threadCount);
		param.setSeed(params.seed);
		param.setVerbosity(params.verbosityLevel);
		if (params.traceobj) {
			int timeBetweenDisplays = static_cast<int>(ceil(MSECS_BETWEEN_TRACES_LONG / 1000.0));
			param.setTimeBetweenDisplays(timeBetweenDisplays);
		}
	}
}
Example #4
0
void ViTrainer::trainSingle()
{
	setIterationLimit(1);
	train();
}
Example #5
0
void ViTrainer::train(ViNeuralNetwork *network, int iterationLimit, qreal errorLimit)
{
	setIterationLimit(iterationLimit);
	setErrorLimit(errorLimit);
	train(network);
}