1.0 - 8.00 - DWT2D 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 climate data in cities in California (CA), Texas (TX), and Washington (WA). The cities are represented by two-dimensional coordinates (latitude and longitude). The data are temperature (in degrees Fahrenheit), pressure (in Mbars), and dew point (in degrees Fahrenheit). The function outputs a coefficient model table and a meta table, which are used as input to the function IDWT2D.

Input

InputTable: twod_climate_data
state city longitude latitude temp_f pressure_mbar dewpoint_f
CA ALPINE -117 32 34.9 1020.5 28.9
CA ALTURAS -121 41 36.6 1022 29.1
CA ANAHEIM -118 33 33.9 1020 28.4
CA AUBURN -122 38 34.9 1020.6 28.8
CA BAKER -117 35 39.4 1022 29.3
CA BARSTOW -118 34 32.3 1020.8 27.6
CA BRIDGEPORT -120 38 33.9 1020.1 28.4
CA BURNEY -122 40 32.3 1020.8 27.6
CA BUTTONWILLOW -120 35 32.1 1021.3 27.4
CA CALISTOGA -123 38 33.8 1021.7 28.2
CA CALLAHAN -123 41 34.6 1020.2 28.8
CA CECILVILLE -124 41 33.8 1021.7 28.3
CA CLOVERDALE -124 38 32.1 1021.3 27.4
CA COVELO -124 39 33.5 1020.2 28.3
CA GLENNVILLE -119 35 33.8 1021.7 28.2
CA HAIWEE -118 36 33.1 1020.2 28
CA HEMET -117 33 33.4 1020.2 28.3
CA IMPERIAL -116 32 34.4 1020.2 28.7
CA KENTFIELD -123 37 32.7 1020 27.9
CA KLAMATH -125 41 32.1 1021.3 27.5
... ... ... ... ... ... ...

SQL Call

SELECT * FROM DWT2D (
  ON twod_climate_data AS InputTable
  OUT TABLE OutputTable (dwt2d_coeftable)
  OUT TABLE MetaTable (dwt2d_metatable)
  USING
  TargetColumns ('temp_f','pressure_mbar','dewpoint_f')
  PartitionColumns ('state')
  IndexColumns ('latitude', 'longitude')
  Wavelet ('db2')
  CompactOutput ('true')
  WaveletTransformLevel (2)
) AS dt;

Output

messages
Dwt2D finished successfully!

This query returns the following table:

SELECT * FROM dwt2d_coeftable ORDER BY state, waveletid, waveletcomponent;
dwt2d_coeftable
state waveletid waveletcomponent temp_f pressure_mbar dewpoint_f
CA 2 A2 0.17966669835468 5.36757777911124 0.148645986178623
CA 3 A2 -2.87944346786742 -80.8379456109261 -2.34340157214
CA 4 A2 85.1709979626302 2535.2091172814 71.2034084720052
CA 5 A2 -0.436988155749943 -14.3013671884212 -0.376569632995601
CA 6 A2 -3.55180132008231 -112.247317693092 -3.0373591242726
CA 7 A2 7.60713133087065 243.037739802494 6.52714999027827
CA 8 A2 77.4836280596588 2309.16778018649 64.6775876908445
CA 9 A2 -2.46718542424233 -72.80570147524 -2.05597029843014
CA 10 A2 4.30723732587148 138.964984443667 3.69857066310935
CA 11 A2 96.5053215632833 2957.68800764973 81.4818568951578
CA 12 A2 25.3705204940491 735.022235657688 20.500350016632
CA 13 A2 99.1650690684055 3095.43307260088 84.2697548740767
CA 14 A2 107.004206852775 3304.81413538727 90.5346298352776
CA 15 A2 68.9704953989846 2042.42993680917 57.0258488992799
CA 18 V2 0.180465820688191 5.49632155551756 0.154427777499678
CA 19 V2 -7.00925368266406 -214.817509066481 -5.94270114993037
CA 20 V2 11.9457843720894 336.444066140318 9.65974360626963
... ... ... ... ... ...
CompactOutput('true') prevents rows in which all coefficient values have an absolute value less than 1e-12) from appearing in dwt2d_coeftable.

This query returns the following table:

SELECT * FROM dwt2d_metatable ORDER BY state;
dwt2d_metatable
state meta content
CA blocklength (4, 4),(4, 4),(4, 4),(4, 4),(6, 6),(6, 6),(6, 6)
CA length (10, 10)
CA wavelet db2
CA lowpassfilter -0.1294095225512604, 0.2241438680420134, 0.836516303737808, 0.4829629131445342
CA highpassfilter -0.4829629131445342, 0.836516303737808, -0.2241438680420134, -0.1294095225512604
CA ilowpassfilter 0.4829629131445342, 0.836516303737808, 0.2241438680420134, -0.1294095225512604
CA ihighpassfilter -0.1294095225512604, -0.2241438680420134, 0.836516303737808, -0.4829629131445342
CA level 2
CA extensionmode sym
CA range (32,-125),(41,-116)
TX blocklength (5, 5),(5, 5),(5, 5),(5, 5),(7, 7),(7, 7),(7, 7)
TX length (11, 11)
TX wavelet db2
TX lowpassfilter -0.1294095225512604, 0.2241438680420134, 0.836516303737808, 0.4829629131445342
TX highpassfilter -0.4829629131445342, 0.836516303737808, -0.2241438680420134, -0.1294095225512604
TX ilowpassfilter 0.4829629131445342, 0.836516303737808, 0.2241438680420134, -0.1294095225512604
TX ihighpassfilter -0.1294095225512604, -0.2241438680420134, 0.836516303737808, -0.4829629131445342
TX level 2
TX extensionmode sym
TX range (26,-105),(36,-95)
WA blocklength (3, 4),(3, 4),(3, 4),(3, 4),(3, 5),(3, 5),(3, 5)
WA length (4, 8)
WA wavelet db2
WA lowpassfilter -0.1294095225512604, 0.2241438680420134, 0.836516303737808, 0.4829629131445342
WA highpassfilter -0.4829629131445342, 0.836516303737808, -0.2241438680420134, -0.1294095225512604
WA ilowpassfilter 0.4829629131445342, 0.836516303737808, 0.2241438680420134, -0.1294095225512604
WA ihighpassfilter -0.1294095225512604, -0.2241438680420134, 0.836516303737808, -0.4829629131445342
WA level 2
WA extensionmode sym
WA range (45,-125),(48,-118)