Histogram Example: CustomBinTable - Teradata Vantage

Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
8.10
1.1
Published
October 2019
Language
English (United States)
Last Update
2019-12-31
dita:mapPath
ima1540829771750.ditamap
dita:ditavalPath
jsj1481748799576.ditaval
dita:id
B700-4003
lifecycle
previous
Product Category
Teradata Vantageā„¢

Input

bin_breaks
break
50.0
100.0
150.0
200.0
250.0
300.0
350.0

SQL Call

SELECT * FROM Histogram(
  ON cars_hist AS InputTable
  ON bin_breaks AS CustomBinTable
  OUT TABLE OutputTable(cars_hist_out2)
  USING
  CustomBinColumn('break')
  ValueColumn('hp')
  GroupbyColumns('cyl')
) AS dt;

Output

 output_table                      output_columns                                    
 --------------------------------- ------------------------------------------------- 
 specified in OutputTable argument "cyl" bin bin_start bin_end bin_count bin_percent
SELECT * FROM cars_hist_out2;
 cyl bin bin_start bin_end bin_count bin_percent 
 --- --- --------- ------- --------- ----------- 
   4   1     100.0   150.0         2       18.18
   4   3     200.0   250.0         0           0
   4   5     300.0   350.0         0           0
   8   1     100.0   150.0         0           0
   8   3     200.0   250.0         5       35.71
   8   5     300.0   350.0         1        7.14
   6   1     100.0   150.0         6       85.71
   6   3     200.0   250.0         0           0
   6   5     300.0   350.0         0           0
   4   0      50.0   100.0         9       81.82
   4   2     150.0   200.0         0           0
   4   4     250.0   300.0         0           0
   8   0      50.0   100.0         0           0
   8   2     150.0   200.0         7          50
   8   4     250.0   300.0         1        7.14
   6   0      50.0   100.0         0           0
   6   2     150.0   200.0         1       14.29
   6   4     250.0   300.0         0           0

Download a zip file of all examples and a SQL script file that creates their input tables from the attachment in the left sidebar.