Algorithm-DecisionTree
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
}
},
"configure" : {
"requires" : {
"ExtUtils::MakeMaker" : "0"
}
},
"runtime" : {
"requires" : {
"List::Util" : "1.33",
"Math::Random" : "0"
}
}
},
"release_status" : "stable",
"version" : "3.43",
"x_serialization_backend" : "JSON::PP version 2.27300"
}
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: '1.4'
name: Algorithm-DecisionTree
no_index:
directory:
- t
- inc
requires:
List::Util: '1.33'
Math::Random: '0'
version: '3.43'
x_serialization_backend: 'CPAN::Meta::YAML version 0.012'
Makefile.PL view on Meta::CPAN
#if ($^V lt v5.10) {
# die("Algorithm::DecisionTree has been tested on Perl 5.10.1.\n" .
# "Your perl version is $].\n");
#}
copy("perl/MANIFEST.perl","MANIFEST");
WriteMakefile(
NAME => 'Algorithm::DecisionTree',
VERSION_FROM => 'lib/Algorithm/DecisionTree.pm',
PREREQ_PM => { Math::Random => 0,
List::Util => 1.33,
},
AUTHOR => 'Avinash Kak (kak@purdue.edu)',
ABSTRACT => 'A Perl module for decision-tree based classification of multidimensional data',
clean => {FILES => join(" ",
map { "$_ */$_ */*/$_" }
qw( *% *.html *.b[ac]k *.old *.orig ) )
},
);
lib/Algorithm/DecisionTree.pm view on Meta::CPAN
}
}
$self->{_class_names} = \@class_names;
$self->{_class_names_and_priors} = \%class_names_and_priors;
$self->{_features_with_value_range} = \%features_with_value_range;
$self->{_classes_and_their_param_values} = \%classes_and_their_param_values;
$self->{_features_ordered} = \@features_ordered;
}
## After the parameter file is parsed by the previous method, this method calls on
## Math::Random::random_multivariate_normal() to generate the training and test data
## samples. Your training and test data can be of any number of of dimensions, can
## have any mean, and any covariance. The training and test data must obviously be
## drawn from the same distribution.
sub gen_numeric_training_and_test_data_and_write_to_csv {
use Math::Random;
my $self = shift;
my %training_samples_for_class;
my %test_samples_for_class;
foreach my $class_name (@{$self->{_class_names}}) {
$training_samples_for_class{$class_name} = [];
$test_samples_for_class{$class_name} = [];
}
foreach my $class_name (keys %{$self->{_classes_and_their_param_values}}) {
my @mean = @{$self->{_classes_and_their_param_values}->{$class_name}->{'mean'}};
my @covariance = @{$self->{_classes_and_their_param_values}->{$class_name}->{'covariance'}};
my @new_training_data = Math::Random::random_multivariate_normal(
$self->{_number_of_samples_for_training} * $self->{_class_names_and_priors}->{$class_name},
@mean, @covariance );
my @new_test_data = Math::Random::random_multivariate_normal(
$self->{_number_of_samples_for_testing} * $self->{_class_names_and_priors}->{$class_name},
@mean, @covariance );
if ($self->{_debug}) {
print "training data for class $class_name:\n";
foreach my $x (@new_training_data) {print "@$x\n";}
print "\n\ntest data for class $class_name:\n";
foreach my $x (@new_test_data) {print "@$x\n";}
}
$training_samples_for_class{$class_name} = \@new_training_data;
$test_samples_for_class{$class_name} = \@new_test_data;
view all matches for this distributionview release on metacpan - search on metacpan
( run in 1.913 second using v1.00-cache-2.02-grep-82fe00e-cpan-1925d2aa809 )