AI-DecisionTree
view release on metacpan or search on metacpan
Instance/Instance.xs view on Meta::CPAN
#ifdef __cplusplus
extern "C" {
#endif
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#ifdef __cplusplus
}
#endif
typedef struct {
char *name;
int result;
int num_values;
int *values;
} Instance;
MODULE = AI::DecisionTree::Instance PACKAGE = AI::DecisionTree::Instance
PROTOTYPES: DISABLE
Instance/typemap view on Meta::CPAN
TYPEMAP
Instance * WRAPPED_C_OBJECT
INPUT
WRAPPED_C_OBJECT
$var = (($type)SvIV(SvRV($arg)))
OUTPUT
WRAPPED_C_OBJECT
/* 'class' must be an argument to any function that returns this datatype */
sv_setref_pv($arg, class, (void*)$var);
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19xx name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the
appropriate parts of the General Public License. Of course, the
commands you use may be called something other than `show w' and `show
c'; they could even be mouse-clicks or menu items--whatever suits your
program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here a sample; alter the names:
Changes
INSTALL
Instance/Instance.pm
Instance/Instance.xs
Instance/Makefile.PL
Instance/t/01-basic.t
Instance/t/02-leaktest.t
Instance/typemap
LICENSE
MANIFEST
META.yml
Makefile.PL
README
SIGNATURE
dist.ini
eg/example.pl
lib/AI/DecisionTree.pm
t/01-simple.t
This file contains message digests of all files listed in MANIFEST,
signed via the Module::Signature module, version 0.68.
To verify the content in this distribution, first make sure you have
Module::Signature installed, then type:
% cpansign -v
It will check each file's integrity, as well as the signature's
validity. If "==> Signature verified OK! <==" is not displayed,
the distribution may already have been compromised, and you should
not run its Makefile.PL or Build.PL.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
SHA1 e01a2ac643b28c7aa7d0d07a8185899a6aa32b13 Changes
SHA1 96da61eea928700509e1a616e036564035244a72 INSTALL
SHA1 7895b6323a97d46368eed8d0386db448d7e7dea0 Instance/Instance.pm
SHA1 98866c7c1b5c1bf6fd38b762ccb6bf6b053045df Instance/Instance.xs
SHA1 998f560a410f706d948b4bc373a99a00bea4f9ac Instance/Makefile.PL
SHA1 fe6397abc886b83d6f61f8efc9fd5d41a5d73ec6 Instance/t/01-basic.t
SHA1 2398adf915f9ac9383783ff279394f78138b805d Instance/t/02-leaktest.t
SHA1 57eae1c6196bbd84c32eb08e1b9db3b2d4e394b0 Instance/typemap
SHA1 b33df3650303ca968f350ac6a976f34f41762851 LICENSE
SHA1 7d2f601dbd1f9ae98ef59cacd828f7ce2675cd9c MANIFEST
SHA1 fc7255a5efe2c3b3cbc1bbb8f099e62f51cc9d5b META.yml
SHA1 f3f560a3566adacd46cab640a59fba80a910092c Makefile.PL
SHA1 812540cf2be2d26d622a363c9ea6fb76c3983995 README
SHA1 b5b9aafd9c2d8e21e669506b46a5e1f0387d0bcc dist.ini
SHA1 73ad1b764e8b3ca6cc3a204a4260e53f14cbc6a0 eg/example.pl
SHA1 d28b3d5fbbe669456f9f1c73d198d0be1dfaa872 lib/AI/DecisionTree.pm
SHA1 cc1fbcb2131905c9474ac2d38abac368dd1a5d20 t/01-simple.t
SHA1 8dd1b0848cd98888419bdbace9453dbc978275b0 t/02-noisy.t
t/02-noisy.t view on Meta::CPAN
#########################
my $dtree = AI::DecisionTree->new(noise_mode => 'pick_best');
ok $dtree;
my @names = split /, /, <DATA>;
chomp $names[-1];
# Train on first 600 instances
printf "Loading 600 training instances with %d attribute types each\n", scalar @names;
while (<DATA>) {
last unless 2..601;
chomp;
my @values = split /, /, $_;
my $result = pop @values;
my %pairs = map {$names[$_], $values[$_]} 0..$#names;
$dtree->add_instance(attributes => \%pairs,
result => $result,
( run in 0.557 second using v1.01-cache-2.11-cpan-64ef6c95b5d )