In [1]:
import pandas as pd
import numpy as np

import pyaf.ForecastEngine as autof
import pyaf.Bench.TS_datasets as tsds
import pyaf.Bench.NN3 as tNN3

%matplotlib inline

In [6]:
tester1 = tNN3.cNN_Tester(tsds.load_NN3_part1() , "NN3_PART_1");
#tester1.testAllSignals()

tester1.testSignals('NN3-001')


BENCH_TYPE NN3_PART_1 OneDataFrameForAllSignals
BENCH_DATA NN3_PART_1 <pyaf.Bench.TS_datasets.cTimeSeriesDatasetSpec object at 0x7ff38168e630>
TIME :  Date N= 67 H= 2 HEAD= [0 1 2 3 4] TAIL= [62 63 64 65 66]
SIGNAL :  NN3-001 N= 67 H= 2 HEAD= [ 5520.  3940.  4490.  5030.  5660.] TAIL= [ 6190.  5250.  5910.  6430.  5950.]
   NN3-001  Date
0   5520.0     0
1   3940.0     1
2   4490.0     2
3   5030.0     3
4   5660.0     4
<class 'pandas.core.frame.DataFrame'>
Int64Index: 67 entries, 0 to 66
Data columns (total 2 columns):
NN3-001    67 non-null float64
Date       67 non-null int64
dtypes: float64(1), int64(1)
memory usage: 1.6 KB
None
     Transformation                                              Model  \
0          _NN3-001  _NN3-001_ConstantTrend_residue_zeroCycle_resid...   
1          _NN3-001  _NN3-001_ConstantTrend_residue_bestCycle_byL2_...   
2          _NN3-001  _NN3-001_ConstantTrend_residue_bestCycle_byL2_...   
3          _NN3-001  _NN3-001_ConstantTrend_residue_zeroCycle_resid...   
4    CumSum_NN3-001  CumSum_NN3-001_LinearTrend_residue_zeroCycle_r...   
5          _NN3-001  _NN3-001_Lag1Trend_residue_bestCycle_byL2_resi...   
6          _NN3-001  _NN3-001_Lag1Trend_residue_zeroCycle_residue_NoAR   
7    CumSum_NN3-001  CumSum_NN3-001_Lag1Trend_residue_zeroCycle_res...   
8      Diff_NN3-001  Diff_NN3-001_Lag1Trend_residue_zeroCycle_resid...   
9   RelDiff_NN3-001  RelDiff_NN3-001_Lag1Trend_residue_zeroCycle_re...   
10     Diff_NN3-001  Diff_NN3-001_ConstantTrend_residue_bestCycle_b...   
11   CumSum_NN3-001  CumSum_NN3-001_PolyTrend_residue_zeroCycle_res...   
12   CumSum_NN3-001  CumSum_NN3-001_Lag1Trend_residue_zeroCycle_res...   
13   CumSum_NN3-001  CumSum_NN3-001_ConstantTrend_residue_zeroCycle...   
14         _NN3-001  _NN3-001_Lag1Trend_residue_zeroCycle_residue_A...   
15         _NN3-001  _NN3-001_Lag1Trend_residue_bestCycle_byL2_resi...   
16   CumSum_NN3-001  CumSum_NN3-001_Lag1Trend_residue_bestCycle_byL...   
17   CumSum_NN3-001  CumSum_NN3-001_PolyTrend_residue_bestCycle_byL...   
18   CumSum_NN3-001  CumSum_NN3-001_LinearTrend_residue_bestCycle_b...   
19         _NN3-001  _NN3-001_PolyTrend_residue_bestCycle_byL2_resi...   
20     Diff_NN3-001  Diff_NN3-001_LinearTrend_residue_bestCycle_byL...   
21         _NN3-001  _NN3-001_LinearTrend_residue_bestCycle_byL2_re...   
22         _NN3-001  _NN3-001_PolyTrend_residue_bestCycle_byL2_resi...   
23         _NN3-001  _NN3-001_PolyTrend_residue_zeroCycle_residue_NoAR   
24         _NN3-001  _NN3-001_LinearTrend_residue_bestCycle_byL2_re...   
25     Diff_NN3-001  Diff_NN3-001_ConstantTrend_residue_zeroCycle_r...   
26         _NN3-001  _NN3-001_LinearTrend_residue_zeroCycle_residue...   
27   CumSum_NN3-001  CumSum_NN3-001_ConstantTrend_residue_bestCycle...   
28         _NN3-001  _NN3-001_PolyTrend_residue_zeroCycle_residue_A...   
29         _NN3-001  _NN3-001_LinearTrend_residue_zeroCycle_residue...   
..              ...                                                ...   
34     Diff_NN3-001  Diff_NN3-001_Lag1Trend_residue_bestCycle_byL2_...   
35     Diff_NN3-001  Diff_NN3-001_LinearTrend_residue_zeroCycle_res...   
36  RelDiff_NN3-001  RelDiff_NN3-001_PolyTrend_residue_zeroCycle_re...   
37  RelDiff_NN3-001  RelDiff_NN3-001_Lag1Trend_residue_zeroCycle_re...   
38  RelDiff_NN3-001  RelDiff_NN3-001_PolyTrend_residue_bestCycle_by...   
39   CumSum_NN3-001  CumSum_NN3-001_LinearTrend_residue_bestCycle_b...   
40  RelDiff_NN3-001  RelDiff_NN3-001_Lag1Trend_residue_bestCycle_by...   
41     Diff_NN3-001  Diff_NN3-001_ConstantTrend_residue_bestCycle_b...   
42     Diff_NN3-001  Diff_NN3-001_ConstantTrend_residue_zeroCycle_r...   
43  RelDiff_NN3-001  RelDiff_NN3-001_PolyTrend_residue_zeroCycle_re...   
44  RelDiff_NN3-001  RelDiff_NN3-001_PolyTrend_residue_bestCycle_by...   
45     Diff_NN3-001  Diff_NN3-001_PolyTrend_residue_bestCycle_byL2_...   
46  RelDiff_NN3-001  RelDiff_NN3-001_ConstantTrend_residue_zeroCycl...   
47  RelDiff_NN3-001  RelDiff_NN3-001_ConstantTrend_residue_bestCycl...   
48  RelDiff_NN3-001  RelDiff_NN3-001_ConstantTrend_residue_zeroCycl...   
49  RelDiff_NN3-001  RelDiff_NN3-001_LinearTrend_residue_zeroCycle_...   
50  RelDiff_NN3-001  RelDiff_NN3-001_ConstantTrend_residue_bestCycl...   
51  RelDiff_NN3-001  RelDiff_NN3-001_LinearTrend_residue_bestCycle_...   
52  RelDiff_NN3-001  RelDiff_NN3-001_LinearTrend_residue_zeroCycle_...   
53  RelDiff_NN3-001  RelDiff_NN3-001_LinearTrend_residue_bestCycle_...   
54  RelDiff_NN3-001  RelDiff_NN3-001_Lag1Trend_residue_bestCycle_by...   
55     Diff_NN3-001  Diff_NN3-001_PolyTrend_residue_bestCycle_byL2_...   
56     Diff_NN3-001  Diff_NN3-001_Lag1Trend_residue_zeroCycle_resid...   
57     Diff_NN3-001  Diff_NN3-001_Lag1Trend_residue_bestCycle_byL2_...   
58     Diff_NN3-001  Diff_NN3-001_PolyTrend_residue_zeroCycle_resid...   
59     Diff_NN3-001  Diff_NN3-001_PolyTrend_residue_zeroCycle_resid...   
60   CumSum_NN3-001  CumSum_NN3-001_PolyTrend_residue_zeroCycle_res...   
61   CumSum_NN3-001  CumSum_NN3-001_PolyTrend_residue_bestCycle_byL...   
62   CumSum_NN3-001  CumSum_NN3-001_ConstantTrend_residue_zeroCycle...   
63   CumSum_NN3-001  CumSum_NN3-001_ConstantTrend_residue_bestCycle...   

    Complexity  FitCount         FitL2  FitMAPE  ForecastCount   ForecastL2  \
0            0        52    723.815575   0.1043             13   441.319339   
1            8        52    692.791329   0.0983             13   442.444672   
2           24        52    558.010536   0.0769             13   480.712805   
3           16        52    604.446093   0.0838             13   505.929016   
4           64        52    808.218853   0.1166             13   539.194474   
5           40        52    859.561626   0.1199             13   538.788659   
6           32        52    896.183146   0.1267             13   523.391308   
7           64        52   1026.482980   0.1382             13   523.391308   
8           64        52    896.183146   0.1267             13   523.391308   
9           64        52    896.183146   0.1267             13   523.391308   
10          40        52    798.819140   0.1054             13   543.356509   
11          64        52    851.431173   0.1191             13   578.706342   
12          80        52   1108.700799   0.1505             13   600.269967   
13          48        52   1108.362645   0.1503             13   616.734856   
14          48        52    611.216896   0.0863             13   611.438259   
15          56        52    585.897224   0.0821             13   627.418172   
16          72        52   1281.131010   0.1467             13   681.624884   
17          72        52   1285.447272   0.1811             13   712.026809   
18          72        52   1103.451077   0.1537             13   775.879625   
19          24        52    592.263885   0.0816             13   743.886065   
20          72        52    656.523407   0.0911             13   802.615799   
21          24        52    592.047757   0.0816             13   755.498898   
22          40        52    512.667358   0.0705             13   754.881368   
23          16        52    625.197334   0.0867             13   737.906817   
24          40        52    512.787814   0.0705             13   761.446925   
25          32        52    914.779970   0.1183             13   784.891778   
26          16        52    625.007223   0.0868             13   749.113956   
27          56        52   2962.792277   0.2959             13   849.096303   
28          32        52    569.941980   0.0798             13   786.769608   
29          32        52    569.976257   0.0797             13   794.429220   
..         ...       ...           ...      ...            ...          ...   
34          88        52    849.657238   0.1175             13  1215.700440   
35          48        52    735.525574   0.1001             13  1229.692045   
36          64        52   1358.317337   0.2146             13  1256.234625   
37          80        52   1029.965182   0.1490             13  1317.913614   
38          72        52   1300.761779   0.2002             13  1342.904033   
39          56        52   3373.840104   0.2962             13  1843.341414   
40          72        52   1061.006296   0.1376             13  1462.417651   
41          56        52    698.949903   0.0947             13  1460.820317   
42          48        52    937.498560   0.1259             13  1543.005577   
43          48        52   1357.819764   0.2113             13  1548.472289   
44          56        52   1333.493038   0.2037             13  1562.698082   
45          72        52    883.041109   0.1246             13  1741.081950   
46          32        52   1197.291011   0.1794             13  1609.968944   
47          40        52   1162.288352   0.1720             13  1609.968944   
48          48        52   1064.009717   0.1527             13  1609.968944   
49          48        52   1362.583992   0.2126             13  1609.968944   
50          56        52   1009.276511   0.1442             13  1609.968944   
51          56        52   1334.974010   0.2048             13  1609.968944   
52          64        52   1365.650404   0.2168             13  1609.968944   
53          72        52   1288.982144   0.2004             13  1609.968944   
54          88        52   1144.173551   0.1721             13  1609.968944   
55          56        52    627.613672   0.0860             13  1933.138028   
56          80        52   1241.538636   0.1654             13  1985.420983   
57          72        52   1242.286669   0.1615             13  1971.206858   
58          48        52    682.099734   0.0944             13  2243.167395   
59          64        52   1746.270610   0.2632             13  3662.480233   
60          48        52   5009.131089   0.3759             13  4897.878173   
61          56        52   5043.364512   0.4201             13  5326.791405   
62          32        52  21434.457906   1.4976             13  6086.552643   
63          40        52  22295.162361   1.5560             13  9547.146543   

    ForecastMAPE  TestCount        TestL2  TestMAPE  
0         0.0557          2    295.785548    0.0377  
1         0.0639          2    242.937430    0.0317  
2         0.0670          2    321.864140    0.0518  
3         0.0708          2     82.201198    0.0121  
4         0.0719          2    547.391776    0.0763  
5         0.0721          2    526.192074    0.0767  
6         0.0722          2    500.399840    0.0808  
7         0.0722          2    500.399840    0.0808  
8         0.0722          2    500.399840    0.0808  
9         0.0722          2    500.399840    0.0808  
10        0.0772          2    418.587254    0.0632  
11        0.0776          2    576.551145    0.0931  
12        0.0809          2    662.202024    0.1061  
13        0.0848          2    621.849841    0.1005  
14        0.0863          2    267.406467    0.0368  
15        0.0865          2    528.888613    0.0835  
16        0.0902          2   1050.976917    0.1637  
17        0.0976          2    255.094740    0.0335  
18        0.1006          2    668.183568    0.1060  
19        0.1044          2    588.929090    0.0936  
20        0.1052          2    581.381547    0.0863  
21        0.1063          2    623.289276    0.0993  
22        0.1067          2    167.756994    0.0228  
23        0.1073          2    651.122199    0.0990  
24        0.1077          2    190.068076    0.0271  
25        0.1078          2    819.052312    0.1252  
26        0.1088          2    684.132101    0.1046  
27        0.1139          2    639.735605    0.1019  
28        0.1163          2    575.888147    0.0917  
29        0.1175          2    606.714113    0.0968  
..           ...        ...           ...       ...  
34        0.1796          2   1777.838880    0.2874  
35        0.1806          2   1796.004838    0.2875  
36        0.1880          2    723.499749    0.1145  
37        0.2065          2    882.654204    0.1409  
38        0.2124          2    465.251688    0.0640  
39        0.2244          2   1666.582482    0.1887  
40        0.2260          2   1750.927921    0.2725  
41        0.2310          2   1260.255281    0.1997  
42        0.2348          2   2272.599321    0.3653  
43        0.2518          2    484.171584    0.0775  
44        0.2540          2    532.841146    0.0860  
45        0.2578          2   4524.690777    0.7309  
46        0.2619          2   1450.000000    0.2329  
47        0.2619          2   1450.000000    0.2329  
48        0.2619          2   1450.000000    0.2329  
49        0.2619          2   1450.000000    0.2329  
50        0.2619          2   1450.000000    0.2329  
51        0.2619          2   1450.000000    0.2329  
52        0.2619          2   1450.000000    0.2329  
53        0.2619          2   1450.000000    0.2329  
54        0.2619          2   1450.000000    0.2329  
55        0.2803          2   3822.194151    0.6186  
56        0.2950          2   2042.484205    0.3307  
57        0.3111          2   2341.655593    0.3677  
58        0.3319          2   4204.303771    0.6797  
59        0.4981          2   7827.437296    1.2660  
60        0.8025          2   6345.347643    1.0273  
61        0.8425          2   5364.191487    0.8227  
62        1.0000          2   6194.650918    1.0000  
63        1.0182          2  10511.629892    1.1615  

[64 rows x 12 columns]
   Transformation                                              Model  \
0        _NN3-001  _NN3-001_ConstantTrend_residue_zeroCycle_resid...   
1        _NN3-001  _NN3-001_ConstantTrend_residue_bestCycle_byL2_...   
2        _NN3-001  _NN3-001_ConstantTrend_residue_bestCycle_byL2_...   
3        _NN3-001  _NN3-001_ConstantTrend_residue_zeroCycle_resid...   
4  CumSum_NN3-001  CumSum_NN3-001_LinearTrend_residue_zeroCycle_r...   

   Complexity  FitCount       FitL2  FitMAPE  ForecastCount  ForecastL2  \
0           0        52  723.815575   0.1043             13  441.319339   
1           8        52  692.791329   0.0983             13  442.444672   
2          24        52  558.010536   0.0769             13  480.712805   
3          16        52  604.446093   0.0838             13  505.929016   
4          64        52  808.218853   0.1166             13  539.194474   

   ForecastMAPE  TestCount      TestL2  TestMAPE  
0        0.0557          2  295.785548    0.0377  
1        0.0639          2  242.937430    0.0317  
2        0.0670          2  321.864140    0.0518  
3        0.0708          2   82.201198    0.0121  
4        0.0719          2  547.391776    0.0763  
2 0    5060.0
1    5400.0
Name: NN3-001, dtype: float64
2 0    6017.115385
1    6017.115385
Name: NN3-001_Forecast, dtype: float64
FORECAST_DETAIL_ACTUAL NN3_Part1 NN3-001 [ 5060.  5400.]
FORECAST_DETAIL_PREDICTED NN3_Part1 NN3-001 [ 6017.11538462  6017.11538462]
BENCHMARK_PERF_DETAIL NN3_Part1 NN3-001 67 2 2.062260389328003 ConstantTrend + NoCycle + NoAR 2 0.1517 0.0702

In [ ]: