#! /bin/bash # Example of running range: simply give it the train and test file names. # It expects to have data preprocessed like this. # This is simply an example so I'm using the same file twice, but please try with others. MyRoot="../../../trunk/" cd .. if [ ! -d /tmp/$USER ] then mkdir /tmp/$USER fi # Set up data to demonstrate usage Data="/tmp/$USER/nasa93_all.csv.numeric" Train="/tmp/$USER/train.csv" Test="/tmp/$USER/test.csv" echo -n "" > $Train echo -n "" > $Test echo "Preprocessing data file" gawk -f $MyRoot"baker_lc/convertcsv.awk" Method="COC81" Style="precise" $MyRoot"data/nasa93.csv" > $Data echo "Preprocessed data stored at "$Data N=$(gawk 'END{print NR}' $Data) i=$(gawk -v X=$RANDOM -v N=$N 'BEGIN{print int(N*(X/32767))}') gawk -v X=$i -v Train=$Train -v Test=$Test '{if(NR==X){print $0 >> Test}else{print $0 >> Train}}' $Data echo "Training file generated and stored at "$Train echo "Test file generated and stored at "$Test echo "" # Run range ./range $Train $Test