Split Input into Training and Testing Data Sets - 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

This code divides the 150 data rows into a training data set (80%) and a testing data set (20%):

DROP TABLE IF EXISTS gmm_iris_train;
DROP TABLE IF EXISTS gmm_iris_test;

CREATE TABLE gmm_iris_train AS
  SELECT * FROM gmm_iris_input WHERE id%5!=0;

CREATE TABLE gmm_iris_test AS
  SELECT * FROM gmm_iris_input WHERE id%5=0;
Alternatively, you can do the preceding task with the Sample or RandomSample function.