The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Algorithm::FeatureSelection -

SYNOPSIS

  use Algorithm::FeatureSelection;
  my $fs = Algorithm::FeatureSelection->new();

  # feature-class data structure ...
  my $features = {
    feature_1 => {
        class_a => 10,
        class_b => 2,
    },
    feature_2 => {
        class_b => 11,
        class_d => 32
    },
          .
          .
          .
  };

  # get pairwise-mutula-information
  my $pmi = $fs->calc_pairwise_mutual_information($features);
  my $pmi = $fs->calc_pmi($features); # same above

  # get information-gain 
  my $ig = $fs->calc_information_gain($features);
  my $ig = $fs->calc_ig($features); # same above

DESCRIPTION

This library is an perl implementation of 'Pairwaise Mutual Information' and 'Information Gain' that are used as well-known method of feature selection on text mining fields.

METHOD

new()

calc_information_gain( $features )

  my $features = {
    feature_1 => {
        class_a => 10,
        class_b => 2,
    },
    feature_2 => {
        class_b => 11,
        class_d => 32
    },
          .
          .
          .
  };
  my $fs = Algorithm::FeatureSelection->new();
  my $ig = $fs->information_gain($features);

calc_ig( $features )

  short name of calc_information_gain()

calc_pairwise_mutual_information( $features )

  my $features = {
    feature_1 => {
        class_a => 10,
        class_b => 2,
    },
    feature_2 => {
        class_b => 11,
        class_d => 32
    },
          .
          .
          .
  };
  my $fs = Algorithm::FeatureSelection->new();
  my $pmi = $fs->calc_pairwise_mutual_information($features);

calc_pmi( $features )

  short name of calc_pairwise_mutual_information()

calc_entropy(HASH|ARRAY)

  calcurate entropy. 

AUTHOR

Takeshi Miki <miki@cpan.org>

SEE ALSO

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.