1.0 - 8.00 - DWT Example - Teradata Vantage

Teradata® Vantage Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
1.0
8.00
Release Date
May 2019
Content Type
Programming Reference
Publication ID
B700-4003-098K
Language
English (United States)

This example uses hourly climate data for five cities (Asheville, Greenville, Brownsville, Nashville and Knoxville) on a given day. The data are temperature (in degrees Fahrenheit), pressure (in mbars), and dewpoint (in degrees Fahrenheit). The function creates the coefficient model table and the meta table, which are used as input to the function IDWT.

Input

InputTable: ville_climatedata
city period temp_f pressure_mbar dewpoint_f
Asheville 2010-01-01 00:00:00 34.9 1020.5 28.9
Asheville 2010-01-01 01:00:00 34.4 1020.2 28.7
Asheville 2010-01-01 02:00:00 33.9 1020 28.4
Asheville 2010-01-01 03:00:00 33.4 1020.2 28.3
Asheville 2010-01-01 04:00:00 33.1 1020.2 28
Asheville 2010-01-01 05:00:00 32.7 1020 27.9
Asheville 2010-01-01 06:00:00 32.5 1020.3 27.7
Asheville 2010-01-01 07:00:00 32.3 1020.8 27.6
Asheville 2010-01-01 08:00:00 32.1 1021.3 27.4
Asheville 2010-01-01 09:00:00 33.8 1021.7 28.2
Asheville 2010-01-01 10:00:00 36.4 1022.1 28.9
Asheville 2010-01-01 11:00:00 39.4 1022 29.3
Asheville 2010-01-01 12:00:00 42.1 1021.1 29.2
Asheville 2010-01-01 13:00:00 44.2 1020 29.1
Asheville 2010-01-01 14:00:00 45.6 1019.3 28.9
Asheville 2010-01-01 15:00:00 46.2 1019 28.5
Asheville 2010-01-01 16:00:00 45.8 1019.2 28.5
Asheville 2010-01-01 17:00:00 44.1 1019.6 28.6
Asheville 2010-01-01 18:00:00 41.2 1020.1 28.5
Asheville 2010-01-01 19:00:00 39.6 1020.6 28.8
Asheville 2010-01-01 20:00:00 38.2 1020.9 29
Asheville 2010-01-01 21:00:00 37.2 1021.1 29
Asheville 2010-01-01 22:00:00 36.3 1021 29
Asheville 2010-01-01 23:00:00 35.5 1020.9 29
Brownsville 2010-01-01 00:00:00 35.1 1020.5 28.9
Brownsville 2010-01-01 01:00:00 34.6 1020.2 28.8
Brownsville 2010-01-01 02:00:00 34.1 1020 28.5
Brownsville 2010-01-01 03:00:00 33.7 1020.1 28.4
... ... ... ... ...

SQL Call

SELECT * FROM DWT (
  ON ville_climatedata AS InputTable
  OUT TABLE OutputTable (dwt_coef_table)
  OUT TABLE MetaTable (dwt_meta_table)
  USING
  TargetColumns ('temp_f', 'pressure_mbar', 'dewpoint_f')
  SortColumn ('period')
  PartitionColumns ('city')
  Wavelet ('db2')
  WaveletTransformLevel (2)
) AS dt;

Output

message
 
Dwt finished successfully!

This query returns the following table:

SELECT * FROM dwt_coef_table ORDER BY city, waveletid, waveletcomponent;
dwt_coef_table
city waveletid waveletcomponent temp_f pressure_mbar dewpoint_f
Asheville 1 A2 69.4540094027039 2040.77288421713 57.6536778800559
Asheville 2 A2 69.3002350407891 2040.65034008677  
Asheville 3 A2 65.9380138856981 2040.05868411008 56.0059210207892
Asheville 4 A2 65.3687921302244 2042.91209425196 55.7742876107938
Asheville 5 A2 84.1422926636037 2041.64689638287 58.2670431589452
Asheville 6 A2 90.1564867623684 2038.66915729816 57.0999120742162
Asheville 7 A2 76.6292062444649 2041.64172802492 57.8025718338419
Asheville 8 A2 71.1744954076401 2041.9750345768 58.0529007176853
Asheville 9 D2 0.166265877365284 0.13357902559369 0.0802319348951208
Asheville 10 D2 -0.0236532579869611 -0.0152743495649474 0.0345987263105307
Asheville 11 D2 -1.08576122940834 -0.392631330035556 -0.529214267460297
Asheville 12 D2 -0.73178478327581 1.58931398112088 0.691473086723903
Asheville 13 D2 3.26344510251065 -1.20694916477225 -0.201106157323093
Asheville 14 D2 -0.748381926835563 0.14607141087663 -0.125329090319905
Asheville 15 D2 -1.40116169247464 0.055816120120312 0.0529007176852296
Asheville 16 D2 -0.841593172362995 0.466498721551716 0.197428166158137
Asheville 17 D1 0.306186217847898 0.183704255459304 0.122473786334524
Asheville 18 D1 0 -0.206134749187356 -0.08365170265035
Asheville 19 D1 0.0224122024304982 0.12248196238869 -0.070710273508908
Asheville 20 D1 -0.0258815095837281 -0.161303239447761 -0.0353547995796646
Asheville 21 D1 -0.917630271917533 0.0482845002277372 -0.470022832702245
Asheville 22 D1 -0.309652827602825 0.241459877385864 0.15782975392192
Asheville 23 D1 0.328598420278396 0.200102937320878 0.064705435625207
Asheville 24 D1 0.476955377862531 -0.244956026246825 0.109533031542659
Asheville 25 D1 0.757261434825846 -0.161273761730968 -0.10006023520487
Asheville 26 D1 -0.472558544124134 -0.0129456913733748 -0.167302977780198
Asheville 27 D1 -0.219066556743464 0.0742190413474191 0.109533705892233
Asheville 28 D1 -0.0612381515206977 0.0388133785289142 0
Asheville 29 D1 -0.489897481353545 -0.0612222930706707 0
Brownsville 1 A2 69.8494278769203 2040.77746121021 57.7241015517973
Brownsville 2 A2 69.7081531839714 2040.64241250221 57.6839970736215
Brownsville 3 A2 66.3771886064812 2040.03445096574 56.3260179778376
Brownsville 4 A2 65.7888893814753 2042.77748885299 56.2960582953676
Brownsville 5 A2 84.8067964112814 2041.43991970379 59.0415953806383
Brownsville 6 A2 90.648563090627 2038.63824306649 57.7977881374318
Brownsville 7 A2 77.1037579029709 2041.37803566704 58.4437490787264
Brownsville 8 A2 71.5761715904181 2041.75457522267 58.5050244475344
Brownsville 9 D2 0.174190741199549 0.125651441035643 0.0448557763120334
Brownsville 10 D2 0.0492226945782548 -0.0881776255051818 -0.00122619573711802
... ... ... ... ... ...

This query returns the following table:

SELECT * FROM dwt_meta_table ORDER BY city;
dwt_meta_table
city meta content
Asheville blocklength 8,8,13
Asheville length 24
Asheville waveletname db2
Asheville lowpassfilter -0.1294095225512604, 0.2241438680420134, 0.836516303737808, 0.4829629131445342
Asheville highpassfilter -0.4829629131445342, 0.836516303737808, -0.2241438680420134, -0.1294095225512604
Asheville ilowpassfilter 0.4829629131445342, 0.836516303737808, 0.2241438680420134, -0.1294095225512604
Asheville ihighpassfilter -0.1294095225512604, -0.2241438680420134, 0.836516303737808, -0.4829629131445342
Asheville level 2
Asheville extensionmode sym
Brownsville blocklength 8,8,13
Brownsville length 24
Brownsville waveletname db2
Brownsville lowpassfilter -0.1294095225512604, 0.2241438680420134, 0.836516303737808, 0.4829629131445342
Brownsville highpassfilter -0.4829629131445342, 0.836516303737808, -0.2241438680420134, -0.1294095225512604
Brownsville ilowpassfilter 0.4829629131445342, 0.836516303737808, 0.2241438680420134, -0.1294095225512604
Brownsville ihighpassfilter -0.1294095225512604, -0.2241438680420134, 0.836516303737808, -0.4829629131445342
Brownsville level 2
... ... ...