本文整理汇总了C++中ConfigurationParameters类的典型用法代码示例。如果您正苦于以下问题:C++ ConfigurationParameters类的具体用法?C++ ConfigurationParameters怎么用?C++ ConfigurationParameters使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConfigurationParameters类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: save
void ScaledSigmoidFunction::save(ConfigurationParameters& params, QString prefix)
{
params.startObjectParameters(prefix, "ScaledSigmoidFunction", this);
params.createParameter(prefix, "lambda", QString::number(lambda));
params.createParameter(prefix, "min", QString::number(min));
params.createParameter(prefix, "max", QString::number(max));
}
示例2: configure
void Pattern::configure(ConfigurationParameters& params, QString prefix) {
//--- get all parameters with the prefix 'cluster:'
QStringList clusterList = params.getParametersWithPrefixList( prefix, "cluster:" );
foreach( QString cluster, clusterList ) {
QString id = cluster.split(':')[1];
if ( id.isNull() || id.isEmpty() ) continue;
//--- now, it check if there is a inputs and outputs parameter and load it
QString str = params.getValue( prefix + "inputs:" + id );
DoubleVector inputs;
if (!str.isNull()) {
QStringList list = str.split(QRegExp("\\s+"), QString::SkipEmptyParts);
for( int i=0; i<list.size(); i++) {
inputs.append( list[i].toDouble() );
}
}
str = params.getValue( prefix + "outputs:" + id );
DoubleVector outputs;
if (!str.isNull()) {
QStringList list = str.split(QRegExp("\\s+"), QString::SkipEmptyParts);
for( int i=0; i<list.size(); i++) {
outputs.append( list[i].toDouble() );
}
}
if ( inputs.size() == 0 && outputs.size() == 0 ) continue;
Cluster* cl = params.getObjectFromParameter<Cluster>( prefix+cluster, false, true );
if ( inputs.size() > 0 ) {
setInputsOf( cl, inputs );
}
if ( outputs.size() > 0 ) {
setOutputsOf( cl, outputs );
}
}
示例3: configure
void LinearComboFunction::configure(ConfigurationParameters& params, QString prefix)
{
// We don't need configured component functions here (and they will be
// configured after exiting from this function)
first.reset(params.getObjectFromParameter<OutputFunction>(prefix + "first", false, false));
w1 = 0.0;
QString str = params.getValue(prefix + "w1");
if (!str.isNull()) {
bool ok;
w1 = str.toDouble(&ok);
if (!ok) {
w1 = 0.0;
}
}
second.reset(params.getObjectFromParameter<OutputFunction>(prefix + "second", false, false));
w2 = 0.0;
str = params.getValue(prefix + "w2");
if (!str.isNull()) {
bool ok;
w2 = str.toDouble(&ok);
if (!ok) {
w2 = 0.0;
}
}
// We don't need to reload a reference to the cluster as he calls our setCluster
// function after our creation
}
示例4: save
void Linker::save(ConfigurationParameters& params, QString prefix)
{
Updatable::save( params, prefix );
params.startObjectParameters(prefix, "Linker", this);
params.createParameter(prefix, "from", fromc );
params.createParameter(prefix, "to", toc );
}
示例5: save
void MatrixLinker::save(ConfigurationParameters& params, QString prefix) {
Linker::save( params, prefix );
params.startObjectParameters( prefix, "MatrixLinker", this );
// First creating a string list, then transforming to a single string
QStringList list;
for( unsigned int r=0; r<rows(); r++ ) {
for( unsigned int c=0; c<cols(); c++ ) {
list.push_back(QString::number(w[r][c]));
}
}
params.createParameter(prefix, "weights", list.join(" "));
}
示例6: Linker
MatrixLinker::MatrixLinker( ConfigurationParameters& params, QString prefix )
: Linker( params, prefix ), nrows(from()->numNeurons()), ncols(to()->numNeurons()), w(nrows, ncols, true) {
// the weights are read from a single vector of data supposing they are row-major arranged
QString str = params.getValue(prefix + "weights");
if (!str.isNull()) {
QStringList list = str.split(QRegExp("\\s+"), QString::SkipEmptyParts);
int cycleLength = nrows*ncols;
if (list.size() != cycleLength) {
#ifdef NNFW_DEBUG
qWarning() << "The number of elements of the weights in configuration file (" << list.size()
<< ") is different from the total number of weights (" << cycleLength << ").";
#endif
cycleLength = std::min(list.size(), cycleLength);
}
for( int i=0; i<cycleLength; i++) {
bool ok;
unsigned int r = i/ncols; //--- division may be expensive
unsigned int c = i%ncols; //--- module may be expensive
w[r][c] = list[i].toDouble(&ok);
if (!ok) {
w[r][c] = 0.0;
}
}
}
}
示例7: save
void CopyLinker::save(ConfigurationParameters& params, QString prefix) {
Linker::save( params, prefix );
params.startObjectParameters( prefix, "CopyLinker", this );
switch( mode ) {
case In2In:
params.createParameter( prefix, "mode", "In2In" );
break;
case In2Out:
params.createParameter( prefix, "mode", "In2Out" );
break;
case Out2In:
params.createParameter( prefix, "mode", "Out2In" );
break;
case Out2Out:
params.createParameter( prefix, "mode", "Out2Out" );
break;
}
}
示例8: configure
void Genotype::configure( ConfigurationParameters& params, QString prefix ) {
int newsize = params.getValue( prefix + QString( "bitsize" ) ).toInt();
Q_ASSERT_X( newsize > 0,
"Genotype::configure",
"The bitsize must be present in the config file and its value must be greater than zero" );
resize( newsize );
QString zipdata = params.getValue( prefix + QString( "data" ) );
if ( !zipdata.isNull() ) {
fromCompressedString( zipdata );
}
QStringList valuesList = params.getValue( prefix + QString( "fitness" ) )
.split( QRegExp("\\s+"), QString::SkipEmptyParts );
if ( valuesList.size() > 0 ) {
// read the values of fitness
fitnessv.resize(0);
foreach( QString avalue, valuesList ) {
fitnessv << avalue.toDouble();
}
// safe check
if ( fitnessv.size() == 0 ) {
fitnessv.append( 0 );
}
}
示例9: Linker
CopyLinker::CopyLinker( ConfigurationParameters& params, QString prefix )
: Linker( params, prefix ), dataFrom(), dataTo() {
dimData = qMin( to()->numNeurons(), from()->numNeurons() );
this->mode = (CopyMode)-1;
//--- default initialisation, in the case the user forget to set the parameter
setMode( Out2In );
QString str = params.getValue(prefix + "mode");
if ( !str.isNull() ) {
str = str.toLower();
if ( str == "in2in" ) {
setMode( In2In );
} else if ( str == "in2ou" ) {
setMode( In2Out );
} else if ( str == "out2in" ) {
setMode( Out2In );
} else if ( str == "out2out" ) {
setMode( Out2Out );
}
}
}
示例10: save
void DeterministicRank::save( ConfigurationParameters& params, QString prefix ) {
params.createParameter( prefix, QString("type"), "DeterministicRank" );
params.createParameter( prefix, QString("nTruncation"), QString("%1").arg( nTruncation ) );
}
示例11: configure
void DeterministicRank::configure( ConfigurationParameters& params, QString prefix ) {
nTruncation = params.getValue( prefix + QString( "nTruncation" ) ).toInt();
}