The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

PDLDM::Common - This provides a few basic functions required for data mining with PDL.

SYNOPSIS

    use PDL;
    use PDLDM::Common qw(NormalizeData WritePDL2DtoCSV ReadCSVtoPDL GetSampleWithoutReplacements SetValue);
    
    my $test_pdl = pdl ([[1,2,3,3,4,4,4,5,6,6], [1,1,1,2,2,4,4,5,6,6],[5,3,2,4,2,8,1,0,-2,6]]);
    print "Original: $test_pdl \n";
    NormalizeData($test_pdl);
    print "Normalized: $test_pdl \n";
    
    WritePDL2DtoCSV($test_pdl,'WritePDL2DtoCSV_test.csv');
    
    my $read_csv_pdl = ReadCSVtoPDL('WritePDL2DtoCSV_test.csv');    
    print "CSV Read $read_csv_pdl\n";
    
    my $sample = GetSampleWithoutReplacements(100,10);    
    print "10 samples out of 0 to 99: $sample\n";
    
    print "Original: $test_pdl \n";
    SetValue($test_pdl->slice("2:4,(1)"),pdl(9,9,9),0);
    print "Changed: $test_pdl \n";
    SetValue($test_pdl->slice("2:4,(1)"),pdl(1,1,1),1);
    print "Changed: $test_pdl \n";
    SetValue($test_pdl->slice("2:4,(1)"),pdl(2,2,2),2);
    print "Changed: $test_pdl \n";

DESCRIPTION

NormalizeData

This function in-place min-max nomarlizes a data piddle. Since this changes the data piddle in the input parameter, there are no output parameters. Please make sure you have a copy of your original data, if you need them later.

WritePDL2DtoCSV

Write a 2D piddle to a CSV file.

ReadCSVtoPDL

Read a csv file to a 2D piddle.

WritePDL3DtoCSV

Write a 3D piddle to a CSV file.

GetSampleWithoutReplacements

This produces samples without replacements.

SetValue

Sets values in a piddle. This is required only when a debugger does not support some PDL functions. For example with ActiveState Komodo IDE you may need this function when debugging. SetValue accepts three variables.

1) a piddle that needs to be overwritten, lets say A. 2) a piddle that need to replace A, lets say B. 3) 0: replace A with B. i.e. A = B ; 1: Add B to A. i.e. A = A + B ; 2: Substract B from A = A - B.

It changes A inplace, there for no output arguments are required. The defaults is 0.

DEPENDENCIES

This module requires these other modules and libraries:

PDL

SEE ALSO

Please refer http://pdl.perl.org/ for PDL. PDL is very efficeint in terms of memory and execution time.

AUTHOR

Muthuthanthiri B Thilak Laksiri Fernando

COPYRIGHT AND LICENSE

Copyright (C) 2015 by Muthuthanthiri B Thilak L Fernando

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.22.0 or, at your option, any later version of Perl 5 you may have available.