#!/usr/bin/perl -w # # Author: Grant Thiltgen # # This script is to collect output data from the multiple neural nets # run to test our training protocol. use strict; use English; use File::Basename; use Getopt::Long; use Pod::Usage; my $num_nets; # The number of nets that have data. my $txxalign; # The alignment, for example t05-thin90 my $dataset; # The dataset, for example dunbrack-30pc-1763 my $arch; # The architecture of the neural net. my $alphaname; # The name of the alphabet used in neural net training my $ctrain=1; # Value for declaring if crosstraining data is available my $data; # Data used, for example tr12 or t1c2 GetOptions( "number=i" => \$num_nets , "txxalign=s" => \$txxalign , "dataset=s" => \$dataset , "arch=s" => \$arch , "alphaname=s" => \$alphaname , "data=s" => \$data , "ctrain=i" => \$ctrain , "help|?" => sub {pod2usage("verbose"=>1);} , "man" => sub {pod2usage("verbose"=>2);} ) or pod2usage("verbose" => 0); # Building loops to create the data file. my $line; # Information from the files brought into this. my $trainbits; # storing training data in bits my $crossbits; # storing cross-training data in bits my $testbits; # storing testing data in bits. my $trainq13; # storing q13 training data. my $crossq13; # storing q13 cross-training data. my $testq13; # storing q13 test data my $trainsov; # storing sov training data. my $crosssov; # storing sov cross-training data. my $testsov; # storing sov test data my $trainobj; # storing object training data. my $crossobj; # storing object cross-training data. my $testobj; # storing object test data my @temp; # temporary array for storing data in the line. # This is set up for using crosstraining or without using crosstraining data, but # I currently only have the crosstraining data implemented. if ($ctrain == 1) { print STDOUT "#\ttrain\ttrain\ttrain\ttrain\tcross\tcross\tcross\tcross\ttest\ttest\ttest\ttest\n"; print STDOUT "Net\tbits\tQ13\tSOV\tobject\tbits\tQ13\tSOV\tobject\tbits\tQ13\tSOV\tobject\n"; print STDOUT "5S\t7N\t7N\t7N\t7N\t7N\t7N\t7N\t7N\t7N\t7N\t7N\t7N\n"; for (my $i=1; $i <= $num_nets; $i++) { open (TRAIN, "quality-reports/net$i/$dataset-$txxalign-$arch-$data-$alphaname-from-empty.training") or die "Can't open training file for net$i"; open (CROSS, "quality-reports/net$i/$dataset-$txxalign-$arch-$data-$alphaname-from-empty.train") or die "Can't open cross-training file for net$i"; open (TEST, "quality-reports/net$i/$dataset-$txxalign-$arch-$data-$alphaname-from-empty.test") or die "Can't open test file for net$i"; while ($line = ) { chomp $line; # print STDOUT "$line\t"; if ($line =~ /^#/) { next; } else { @temp = split /\s+/, $line; $trainbits = $temp[3]; $trainq13 = $temp[5]; $trainsov = $temp[6]; $trainobj = $temp[7]; } } while ($line = ) { if ($line =~ /^#/) { next; } chomp $line; @temp = split /\s+/, $line; $crossbits = $temp[3]; $crossq13 = $temp[5]; $crosssov = $temp[6]; $crossobj = $temp[7]; } while ($line = ) { if ($line =~ /^#/) { next; } chomp $line; @temp = split /\s+/, $line; $testbits = $temp[3]; $testq13 = $temp[5]; $testsov = $temp[6]; $testobj = $temp[7]; } print STDOUT "$i\t$trainbits\t$trainq13\t$trainsov\t$trainobj\t$crossbits\t$crossq13\t$crosssov\t$crossobj\t$testbits\t$testq13\t$testsov\t$testobj\n"; } } __END__