TD_SVMPredict Examples | SVMPredict | Teradata Vantage - Examples: How to Use TD_SVMPredict - Analytics Database

Database Analytic Functions

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-04-06
dita:mapPath
gjn1627595495337.ditamap
dita:ditavalPath
ayr1485454803741.ditaval
dita:id
jmh1512506877710
Product Category
Teradata Vantageā„¢

The following data set is used in the examples.

id MedInc HouseAge AveRooms AveBedrms Population AveOccup Latitude Longitude MedHouseVal
14870 1.858 23 3.901 1.077 1025 2.47 32.64 -117.11 0.675
6044 2.114 27 3.855 1.072 1024 4.633 34.05 -117.74 1.109
3593 6.654 32 6.331 0.995 1285 3.104 34.24 -118.48 2.676
9454 1.228 25 5.504 1.154 991 2.629 39.77 -123.23 0.603
18760 3.282 16 5.998 1.076 1414 3.081 40.6 -122.25 1.283
11670 4.5 28 5.102 1.044 2112 2.63 33.84 -118.01 2.021
17768 2.756 29 4.53 1.04 3572 4.603 37.35 -121.85 1.601
244 2.391 44 4.866 1.164 2269 3.72 37.78 -122.22 1.117
5328 2.768 23 3.039 1.064 2031 1.637 34.04 -118.45 2.775
14365 2.164 43 4.533 0.995 392 1.867 32.72 -117.23 2.442
2313 2.486 15 5.468 1.045 649 2.449 36.94 -119.7 0.863
12342 2.588 28 6.268 1.372 3470 2.59 33.84 -116.53 1.59
6558 6.827 36 7.021 1.036 1897 2.71 34.2 -118.11 3.594
17157 9.78 20 6.678 0.918 324 2.219 37.43 -122.21 5
18099 5.753 27 6.437 1.027 1259 2.868 37.32 -122.01 4.314

Model

attribute predictor estimate value
-17 OneClass SVM NaN FALSE
-16 Kernel NaN LINEAR
-15 Intercept Scaling 1.000000 None
-14 Epsilon 0.100000 None
-13 LocalSGD Iterations 0.000000 None
-12 Nesterov NaN FALSE
-11 Momentum 0.000000 None
-10 Learning Rate (Final) 0.204246 None
-9 Learning Rate (Initial) 0.050000 None
-8 Number of Iterations 227.000000 CONVERGED
-7 Alpha 0.150000 Elasticnet
-6 Regularization 0.020000 ENABLED
-5 BIC 5.572674 None
-4 AIC -0.799777 None
-3 Number of Observations 15.000000 None
-2 MSE 0.285556 None
-1 Loss Function NaN EPSILON_INSENSITIVE
0 (Intercept) 2.191718 None
1 MedInc 1.226729 None
2 HouseAge .0232213 None
3 AveRooms -.332659 None
4 AveBedrms 0.000000 None
5 Population 0.113633 None
6 AveOccup -0.286434 None
7 Latitude -0.261509 None
8 Longitude -0.198519 None

Example: TD_SVMPredict Call Using Regression

CREATE VOLATILE TABLE svm_m0del_predict_cal_housing AS (
SELECT * from TD_SVMPredict (
      ON cal_housing_ex_scaled AS INPUTTABLE
      ON svm_model_cal_housing AS ModelTable DIMENSION
      USING
      IDColumn ('id')
      Accumulate('MedHouseVal')
) AS dt
) WITH DATA
ON COMMIT PRESERVE ROWS;

TD_SVMPredict Output for Regression

id prediction MedHouseVal
18760 1.268192 1.28300
244 1.815538 1.11700
9454 0.570297 0.60300
14365 2.280287 2.44200
6558 3.628097 3.59400
12342 1.506883 1.59000
5328 2.709805 2.77500
14870 1.601341 0.67500
17768 1.546305 1.60100
18099 2.855638 4.31400
2313 0.976091 0.86300
3593 3.445194 2.67600
6044 1.025779 1.10900
11670 2.814743 2.02100
17157 4.831587 5.00001

Classification iris Data Set

id sepal_length sepal_width petal_length petal_width variety label
61 5.0 2.0 3.5 1.0 Versicolor 0
51 7.0 3.2 4.7 1.4 Versicolor 0
50 5.1 3.4 1.5 0.2 Setosa 1
59 6.6 2.9 4.6 1.3 Versicolor 0
38 4.9 3.6 1.4 0.1 Setosa 1
... ... ... ... ... ... ...
90 5.5 2.5 4.0 1.3 Versicolor 0
67 5.6 3.0 4.5 1.5 Versicolor 0
44 5.0 3.5 1.6 0.6 Setosa 1
42 4.5 2.3 1.3 0.3 Setosa 1
82 5.5 2.4 3.7 1.0 Versicolor 0

Example: TD_SVMPredict Call Using Classification

CREATE VOLATILE TABLE svm_model_predict_iris_data AS (
SELECT * FROM TD_SVMPredict (
 ON iris_data AS INPUTTABLE
 ON svm_model_iris_data AS ModelTable DIMENSION
 USING
 IdColumn('id')
 Accumulate('label')
 OutputProb('true')
 Responses('0','1')
 ) AS dt
 ) WITH DATA
ON COMMIT PRESERVE ROWS;

TD_SVMPredict Output for Classification

id prediction prob_0 prob_1 label
61 0.0 0.916982 0.083018 0
51 0.0 0.947352 0.052648 0
40 1.0 0.106359 0.893641 1
59 0.0 0.954081 0.045919 0
38 1.0 0.077917 0.922083 1
... ... ... ... ...
90 0.0 0.938794 0.061206 0
67 0.0 0.955700 0.044300 0
44 1.0 0.135795 0.864205 1
42 1.0 0.220665 0.779335 1
82 0.0 0.903738 0.096262 0