TD_OneClassSVM Example | OneClassSVM | Teradata Vantage - Example: How to Use TD_OneClassSVM - 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ā„¢

This is a sample of starting diabetes information.

ID Pregnancies Glucose BloodPressure SkinThickness Insulin BMI DiabetesPedigreeFunction Age
0 3.3536083981879607 0.48047259290010697 0.05216975144869974 0.781406344235634 0.2885973942698338 0.6861199178728551 -0.9469014672703974 0.8102045393863812
1 -1.121017350926504 -0.7689112552631585 -0.2463931955632191 1.0322973498287793 0.19979565193491475 0.6469956368416652 0.39612987480866874 -0.6952620268782791
2 -0.8227089676522064 -0.16023707282464458 0.05216975144869974 0.5305153386424888 -0.6882217714142757 -0.5788985021356031 -0.7936697034090276 -1.0298101527148702
3 -0.5244005843779087 -0.4805919056870203 -0.2463931955632191 0.969574598430493 0.3685189623712609 -0.17461426481331227 2.79976538635957 0.05747125625405104
4 -1.121017350926504 0.06401131017901845 0.9478585924844561 1.0950201012270657 -0.6882217714142757 0.4383328046753223 -0.8147015141350981 -0.3607139010416879
5 -0.8227089676522064 0.7047209759037699 0.7488166278098437 0.2169015816510572 2.0646322409682143 1.3773155494238678 1.8262930041814547 -0.9461731212557224
6 1.5637580985421748 0.09604679346525603 0.05216975144869974 0.8441290956339204 2.8816082704494694 0.46441565869611473 -0.5593152410328147 0.05747125625405104
7 0.6688329487192819 0.8328629090487203 0.5497746631352312 -1.2257217005095282 -0.6882217714142757 -0.305028534917277 -0.8717878575344317 1.3956637596004156
8 0.6688329487192819 0.2562242098964439 1.0473795748217625 -0.7866624407215239 2.206715028704085 -1.5961298089465277 0.3420480757987737 2.2320340741918936
9 -0.22609220110361103 0.28825969318268146 0.4502536807979248 0.2169015816510572 0.013311993031584759 -0.4484842320316384 -0.436128921065831 0.05747125625405104
10 1.8620664818164725 -0.9290886716943464 -0.34591417790052537 -1.2257217005095282 -0.6882217714142757 -0.7745199072915502 -0.9048378458182568 -0.19343983812339233
... ... ... ... ... ... ... ... ...
526 -0.8227089676522064 -0.6728048054044458 -0.14687221322591282 0.5932380900407751 1.0522923783501374 0.021007140342634813 -0.07257904994375701 0.7265675079272333
527 -0.5244005843779087 -1.185372537984247 -0.943040071924363 0.2169015816510572 -0.013328529668890953 -0.18765569182370895 1.5018022101220834 -1.0298101527148702
528 0.6688329487192819 1.3133951583422838 -0.34591417790052537 -1.2257217005095282 -0.6882217714142757 -0.9831827394578935 -0.8717878575344317 1.3956637596004156
529 1.2654497152678772 -0.6728048054044458 0.35073269846061855 -1.2257217005095282 -0.6882217714142757 0.8947827500391988 -0.8357333248611682 0.7265675079272333
530 -1.121017350926504 -0.5126273889732579 0.7488166278098437 -1.2257217005095282 -0.6882217714142757 -0.5136913670836207 0.8197706337195152 2.399308137110189
531 0.07221618217068661 1.0571112920523833 -0.34591417790052537 0.7186835928373477 1.833747710897425 0.1253385564258062 -0.6945197385575529 -0.8625360897965746
532 -0.5244005843779087 1.153217741911096 0.2512117161233123 0.969574598430493 3.219054891322162 0.9860727391119736 -1.0039878106697313 -0.27707686958254013
533 0.9671413319935795 2.1142822404982233 -0.943040071924363 0.8441290956339204 2.7928065281145504 0.2687942535401676 1.0751569068217983 0.05747125625405104
534 2.7569916316393654 0.16011776003773118 1.0473795748217625 -1.2257217005095282 -0.6882217714142757 1.5077298195278326 0.34505262018821203 0.7265675079272333
535 0.07221618217068661 1.601714507918422 0.151690733786006 -1.2257217005095282 -0.6882217714142757 1.533812673548626 0.03258000368659487 -0.6116249954191313
536 1.5637580985421748 -0.6087338388319706 0.35073269846061855 1.0950201012270657 -0.6882217714142757 0.1383799834362029 0.5914252601221797 1.0611156337638246

Example: TD_OneClassSVM Using LearningRate Constant

SELECT * FROM TD_OneClassSVM(
  ON diabetes_train_scaled AS InputTable
  USING
    InputColumns('[1:8]')
    Tolerance(1e-7)
    BatchSize(30)
    LearningRate('constant')
    InitialEta (0.01)
    RegularizationLambda(0.1)
    Alpha(0)
    Momentum (0.0)
    Nesterov ('false')
    MaxIterNum (100)
) AS dt

TD_OneClassSVM Output

Attribute Predictor Estimate Value
0 (Intercept) -0.002  
1 Pregnancies 0.0007820357  
2 Glucose -0.0009073822  
3 BloodPressure -0.0005117763  
4 SkinThickness -0.0001402478  
5 Insulin 0.0013394897  
6 BMI 0.0004039902  
7 DiabetesPedigreeFunction -0.0004613734  
8 Age -0.0011434892  
-1 Loss Function   HINGE
-2 Number of Observations 537  
-3 MSE -0.0001951275  
-4 AIC 18.0003902551  
-5 BIC 56.5743731056  
-6 Regularization 0.1 ENABLED
-7 Alpha 0 L2
-8 Number of Iterations 59 CONVERGED
-9 Learning Rate (Initial) 0.01  
-10 Learning Rate (Final) 0.01  
-11 Momentum 0  
-12 Nesterov   FALSE
-13 LocalSGD Iterations 0  
-15 Intercept Scaling 1  
-16 Sparse   FALSE
-17 Kernel   LINEAR
-18 OneClass SVM   TRUE