• Script to convert data from the LIBSVM to the FANN format
#!/usr/bin/perl
#
# Usage: ./transform.pl <filename> <nfeatures> <noutputs>
#
$filename = $ARGV[0];
$nfeatures = $ARGV[1];
$noutputs = $ARGV[2];
open(DATA,$filename);
 
@lines = <DATA>;
 
$size = $#lines +1;
print "$size $nfeatures $noutputs\n";
 
foreach $line(@lines)
{
	@fields = split (" ", $line);
	$i=0;
	$label="";
	foreach $field(@fields)
	{
		if ($i == 0)
		{
			$label = $field;
			$i++;
		}
		else
		{
			($num, $feature) = split (":",$field);
			print "$feature ";
		}
	}
	print "\n$label\n";
}
close (DATA);

Alumni Liaison

Correspondence Chess Grandmaster and Purdue Alumni

Prof. Dan Fleetwood