@@ -502,6 +502,46 @@ namespace dd
502
502
empty_cuda_cache ();
503
503
}
504
504
505
+ template <class TInputConnectorStrategy , class TOutputConnectorStrategy ,
506
+ class TMLModel >
507
+ double TorchLib<TInputConnectorStrategy, TOutputConnectorStrategy,
508
+ TMLModel>::unscale(double val, unsigned int k,
509
+ const TInputConnectorStrategy &inputc)
510
+ {
511
+ (void )inputc;
512
+ (void )k;
513
+ // unscaling is input connector specific
514
+ return val;
515
+ }
516
+
517
+ // full template specialization
518
+ template <>
519
+ double
520
+ TorchLib<CSVTSTorchInputFileConn, SupervisedOutput, TorchModel>::unscale(
521
+ double val, unsigned int k, const CSVTSTorchInputFileConn &inputc)
522
+
523
+ {
524
+ if (inputc._min_vals .empty () || inputc._max_vals .empty ())
525
+ {
526
+ this ->_logger ->info (" not unscaling output because no bounds "
527
+ " data found" );
528
+ return val;
529
+ }
530
+ else
531
+ {
532
+
533
+ if (!inputc._dont_scale_labels )
534
+ {
535
+ double max = inputc._max_vals [inputc._label_pos [k]];
536
+ double min = inputc._min_vals [inputc._label_pos [k]];
537
+ if (inputc._scale_between_minus1_and_1 )
538
+ val += 0.5 ;
539
+ val = val * (max - min) + min;
540
+ }
541
+ return val;
542
+ }
543
+ }
544
+
505
545
/* - from mllib -*/
506
546
template <class TInputConnectorStrategy , class TOutputConnectorStrategy ,
507
547
class TMLModel >
@@ -1342,7 +1382,8 @@ namespace dd
1342
1382
for (unsigned int k = 0 ; k < this ->_inputc ._ntargets ;
1343
1383
++k)
1344
1384
{
1345
- preds.push_back (output_acc[j][t][k]);
1385
+ double res = output_acc[j][t][k];
1386
+ preds.push_back (unscale (res, k, inputc));
1346
1387
}
1347
1388
APIData ts;
1348
1389
ts.add (" out" , preds);
0 commit comments