22 #include <QStringList>
60 mul( outputs, rate, inputs );
71 QString str = params.
getValue(prefix +
"rate");
74 rate = str.toDouble(&ok);
105 QString str = params.
getValue(prefix +
"gain");
106 if (!str.isEmpty()) {
108 gainv = str.toDouble(&ok);
133 subtract( derivates, 1.0, outputs );
134 derivates *= outputs;
142 QString str = params.
getValue(prefix +
"lambda");
143 if (!str.isEmpty()) {
145 lambda = str.toDouble(&ok);
164 unsigned int size = inputs.
size();
166 double x0 = 6. + 2./3.;
168 for (
unsigned int i = 0; i<size; i++ ) {
171 x -= (.5 - zero) / (.075 + zero);
176 outputs[i] = .5 + .575 * x / ( 1.0 + fabs(x) );
186 subtract( derivates, 1.0, outputs );
187 derivates *= outputs;
195 QString str = params.
getValue(prefix +
"lambda");
196 if (!str.isEmpty()) {
198 lambda = str.toDouble(&ok);
230 subtract( derivates, 1.0, outputs );
231 derivates *= outputs;
239 QString str = params.
getValue(prefix +
"lambda");
240 if (!str.isEmpty()) {
242 lambda = str.toDouble(&ok);
249 str = params.
getValue(prefix +
"min");
250 if (!str.isEmpty()) {
252 min = str.toDouble(&ok);
259 str = params.
getValue(prefix +
"max");
260 if (!str.isEmpty()) {
262 max = str.toDouble(&ok);
294 unsigned int size = inputs.
size();
297 for (
unsigned int i = 0; i<size; i++ ) {
298 double ret = m*(inputs[i]) + q;
301 }
else if (ret >
max_y) {
310 for(
unsigned int i=0; i<inputs.
size(); i++ ) {
311 if ( inputs[i] >=
min_x && inputs[i] <=
max_x ) {
315 y = 1.0/( 1.0 +
std::exp( -inputs[i] ) );
316 derivates[i] = y * ( 1.0 - y );
325 QString str = params.
getValue(prefix +
"minX");
326 if (!str.isEmpty()) {
328 min_x = str.toDouble(&ok);
335 str = params.
getValue(prefix +
"maxX");
336 if (!str.isEmpty()) {
338 max_x = str.toDouble(&ok);
345 str = params.
getValue(prefix +
"minY");
346 if (!str.isEmpty()) {
348 min_y = str.toDouble(&ok);
355 str = params.
getValue(prefix +
"maxY");
356 if (!str.isEmpty()) {
358 max_y = str.toDouble(&ok);
387 mul( outputs,
m, inputs ) +=
b;
398 QString str = params.
getValue(prefix +
"m");
399 if (!str.isEmpty()) {
401 m = str.toDouble(&ok);
408 str = params.
getValue(prefix +
"b");
409 if (!str.isEmpty()) {
411 b = str.toDouble(&ok);
433 unsigned int size = inputs.
size();
434 for (
unsigned int i = 0; i<size; i++ ) {
441 for(
unsigned int i=0; i<inputs.
size(); i++ ) {
443 y = 1.0/( 1.0 +
std::exp( -inputs[i] ) );
444 derivates[i] = y * ( 1.0 - y );
452 QString str = params.
getValue(prefix +
"min");
453 if (!str.isEmpty()) {
455 min = str.toDouble(&ok);
462 str = params.
getValue(prefix +
"max");
463 if (!str.isEmpty()) {
465 max = str.toDouble(&ok);
472 str = params.
getValue(prefix +
"threshold");
473 if (!str.isEmpty()) {
525 QString str = params.
getValue(prefix +
"delta");
526 if (!str.isEmpty()) {
527 QStringList list = str.split(QRegExp(
"\\s+"), QString::SkipEmptyParts);
529 for(
int i = 0; i < list.size(); i++) {
531 delta[i] = list[i].toDouble(&ok);
539 str = params.
getValue(prefix +
"outprev");
540 if (!str.isEmpty()) {
541 QStringList list = str.split(QRegExp(
"\\s+"), QString::SkipEmptyParts);
543 for(
int i = 0; i < list.size(); i++) {
545 outprev[i] = list[i].toDouble(&ok);
560 for (
unsigned int i = 0; i <
delta.
size(); i++) {
561 list.push_back(QString::number(
delta[i]));
567 for (
unsigned int i = 0; i <
delta.
size(); i++) {
568 list.push_back(QString::number(
outprev[i]));
581 outputs =
inv(
mul( outputs,
A, inputs ) += (1.0+
B) );
588 QString str = params.
getValue(prefix +
"A");
589 if (!str.isEmpty()) {
591 A = str.toDouble(&ok);
598 str = params.
getValue(prefix +
"B");
599 if (!str.isEmpty()) {
601 B = str.toDouble(&ok);
628 first->apply( inputs, mid );
629 second->apply( mid, outputs );
697 first->apply( inputs, mid );
699 second->apply( inputs, outputs );
755 QString str = params.
getValue(prefix +
"w1");
756 if (!str.isEmpty()) {
758 w1 = str.toDouble(&ok);
767 str = params.
getValue(prefix +
"w2");
768 if (!str.isEmpty()) {
770 w2 = str.toDouble(&ok);