Train and Test Set - Aster Analytics

Teradata Aster Analytics Foundation User Guide

Product
Aster Analytics
Release Number
6.21
Published
November 2016
Language
English (United States)
Last Update
2018-04-14
dita:mapPath
kiu1466024880662.ditamap
dita:ditavalPath
AA-notempfilter_pdf_output.ditaval
dita:id
B700-1021
lifecycle
previous
Product Category
Software

The input data set has 150 rows that are split into a train set (80%) and a test set (20%). You can perform the split either with the following code or with the Sample function (giving the SampleFraction attribute the value 0.8).

DROP TABLE IF EXISTS svm_iris_train;
DROP TABLE IF EXISTS svm_iris_test;

CREATE TABLE svm_iris_train AS
SELECT * FROM svm_iris WHERE id%5 != 0;

CREATE TABLE svm_iris_test AS
SELECT * FROM svm_iris WHERE id%5 = 0;

The following query returns the output shown in the following table:

SELECT * FROM svm_iris_train ORDER BY id;
DenseSVMTrainer Example Train Set Table svm_iris_train
id sepal_length sepal_width petal_length petal_width species
1 5.1 3.5 1.4 0.2 setosa
2 4.9 3 1.4 0.2 setosa
3 4.7 3.2 1.3 0.2 setosa
4 4.6 3.1 1.5 0.2 setosa
6 5.4 3.9 1.7 0.4 setosa
7 4.6 3.4 1.4 0.3 setosa
8 5 3.4 1.5 0.2 setosa
9 4.4 2.9 1.4 0.2 setosa
11 5.4 3.7 1.5 0.2 setosa
... ... ... ... ... ...

The following query returns the output shown in the following table:

SELECT * FROM svm_iris_test ORDER BY id;
DenseSVMTrainer Example Test Set Table svm_iris_test
id sepal_length sepal_width petal_length petal_width species
5 5 3.6 1.4 0.2 setosa
10 4.9 3.1 1.5 0.1 setosa
15 5.8 4 1.2 0.2 setosa
20 5.1 3.8 1.5 0.3 setosa
25 4.8 3.4 1.9 0.2 setosa
30 4.7 3.2 1.6 0.2 setosa
35 4.9 3.1 1.5 0.2 setosa
40 5.1 3.4 1.5 0.2 setosa
45 5.1 3.8 1.9 0.4 setosa
50 5 3.3 1.4 0.2 setosa
55 6.5 2.8 4.6 1.5 versicolor
60 5.2 2.7 3.9 1.4 versicolor
65 5.6 2.9 3.6 1.3 versicolor
70 5.6 2.5 3.9 1.1 versicolor
... ... ... ... ... ...