AI-XGBoost

 view release on metacpan or  search on metacpan

LICENSE  view on Meta::CPAN

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes

META.json  view on Meta::CPAN

         }
      }
   },
   "release_status" : "stable",
   "resources" : {
      "bugtracker" : {
         "web" : "https://github.com/pablrod/p5-AI-XGBoost/issues"
      },
      "homepage" : "https://github.com/pablrod/p5-AI-XGBoost",
      "repository" : {
         "type" : "git",
         "url" : "https://github.com/pablrod/p5-AI-XGBoost.git",
         "web" : "https://github.com/pablrod/p5-AI-XGBoost"
      }
   },
   "version" : "0.11",
   "x_contributors" : [
      "Ruben <me@ruben.tech>"
   ],
   "x_serialization_backend" : "Cpanel::JSON::XS version 3.0115"
}

dist.ini  view on Meta::CPAN

tag_message = %c
[GatherDir]

[PruneCruft]

[ManifestSkip]
[MetaJSON]
[MetaYAML]
[Readme]
[ReadmeAnyFromPod]
type = gfm
filename = README.md
location = root

[MinimumPerlFast]
[ExtraTests]
[ExecDir]
[ModuleBuild]
[Manifest]
[TestRelease]
[InsertExample]

examples/featmap.txt  view on Meta::CPAN

77	stalk-color-above-ring=yellow	i
78	stalk-color-below-ring=brown	i
79	stalk-color-below-ring=buff	i
80	stalk-color-below-ring=cinnamon	i
81	stalk-color-below-ring=gray	i
82	stalk-color-below-ring=orange	i
83	stalk-color-below-ring=pink	i
84	stalk-color-below-ring=red	i
85	stalk-color-below-ring=white	i
86	stalk-color-below-ring=yellow	i
87	veil-type=partial	i
88	veil-type=universal	i
89	veil-color=brown	i
90	veil-color=orange	i
91	veil-color=white	i
92	veil-color=yellow	i
93	ring-number=none	i
94	ring-number=one	i
95	ring-number=two	i
96	ring-type=cobwebby	i
97	ring-type=evanescent	i
98	ring-type=flaring	i
99	ring-type=large	i
100	ring-type=none	i
101	ring-type=pendant	i
102	ring-type=sheathing	i
103	ring-type=zone	i
104	spore-print-color=black	i
105	spore-print-color=brown	i
106	spore-print-color=buff	i
107	spore-print-color=chocolate	i
108	spore-print-color=green	i
109	spore-print-color=orange	i
110	spore-print-color=purple	i
111	spore-print-color=white	i
112	spore-print-color=yellow	i
113	population=abundant	i

lib/AI/XGBoost/Booster.pm  view on Meta::CPAN


sub get_attr {
    my $self = shift;
    my ($name) = @_;
    XGBoosterGetAttr( $self->_handle, $name );
}

sub get_score {
    my $self = shift;
    my %args = @_;
    my ( $fmap, $importance_type ) = @args{qw(fmap importance_type)};

    if ( $importance_type eq "weight" ) {
        my @trees = $self->get_dump;
    } else {

    }

}

sub get_dump {
    my $self = shift;
    return XGBoosterDumpModelEx( $self->_handle, "", 1, "text" );

lib/AI/XGBoost/Booster.pm  view on Meta::CPAN

Get a string attribute

=head2 get_score

Get importance of each feature

=head3 Parameters

=over 4

=item importance_type

Type of importance. Valid values:

=over 4

=item weight

Number of times a feature is used to split the data across all trees

=item gain

lib/AI/XGBoost/CAPI.pm  view on Meta::CPAN

                AI::XGBoost::CAPI::RAW::XGBoosterDumpModelEx(
                                                   $booster, $feature_map, $with_stats, $format, \$out_len, \$out_result
                )
    );
    my $ffi = FFI::Platypus->new();
    $out_result = $ffi->cast( opaque => "opaque[$out_len]", $out_result );
    return [ map { $ffi->cast( opaque => "string", $_ ) } @$out_result ];
}

sub XGBoosterDumpModelWithFeatures {
    my ( $booster, $feature_names, $feature_types, $with_stats ) = @_;
    $with_stats //= 1;
    my $out_len                       = 0;
    my $out_result                    = 0;
    my $ffi                           = FFI::Platypus->new();
    my $number_of_features            = scalar @$feature_names;
    my $array_of_opaque_feature_names = [ map { $ffi->cast( string => "opaque", $_ ) } @$feature_names ];
    my $array_of_opaque_feature_types = [ map { $ffi->cast( string => "opaque", $_ ) } @$feature_types ];
    _CheckCall(
                AI::XGBoost::CAPI::RAW::XGBoosterDumpModelWithFeatures( $booster, $number_of_features,
                                                                        $array_of_opaque_feature_names,
                                                                        $array_of_opaque_feature_types,
                                                                        $with_stats, \$out_len, \$out_result
                )
    );
    $out_result = $ffi->cast( opaque => "opaque[$out_len]", $out_result );
    return [ map { $ffi->cast( opaque => "string", $_ ) } @$out_result ];
}

sub XGBoosterDumpModelExWithFeatures {
    my ( $booster, $feature_names, $feature_types, $with_stats, $format ) = @_;
    my $out_len                       = 0;
    my $out_result                    = 0;
    my $ffi                           = FFI::Platypus->new();
    my $number_of_features            = scalar @$feature_names;
    my $array_of_opaque_feature_names = [ map { $ffi->cast( string => "opaque", $_ ) } @$feature_names ];
    my $array_of_opaque_feature_types = [ map { $ffi->cast( string => "opaque", $_ ) } @$feature_types ];
    _CheckCall(
                AI::XGBoost::CAPI::RAW::XGBoosterDumpModelExWithFeatures( $booster, $number_of_features,
                                                                          $array_of_opaque_feature_names,
                                                                          $array_of_opaque_feature_types,
                                                                          $with_stats, $format, \$out_len, \$out_result
                )
    );
    $out_result = $ffi->cast( opaque => "opaque[$out_len]", $out_result );
    return [ map { $ffi->cast( opaque => "string", $_ ) } @$out_result ];
}

sub XGBoosterFree {
    my ($booster) = @_;
    _CheckCall( AI::XGBoost::CAPI::RAW::XGBoosterFree($booster) );

lib/AI/XGBoost/DMatrix.pm  view on Meta::CPAN

Array with the labels of the rows of matrix. Optional

=item missing

Value to identify missing values. Optional, default `NaN`

=back

=head2 set_float_info

Set float type property

=head3 Parameters

=over 4

=item field

Field name of the information

=item info

array with the information

=back

=head2 set_float_info_pdl

Set float type property

=head3 Parameters

=over 4

=item field

Field name of the information

=item info

Piddle with the information

=back

=head2 get_float_info

Get float type property

=head3 Parameters

=over 4

=item field

Field name of the information

=back

=head2 set_uint_info

Set uint type property

=head3 Parameters

=over 4

=item field

Field name of the information

=item info

array with the information

=back

=head2 get_uint_info

Get uint type property

=head3 Parameters

=over 4

=item field

Field name of the information

=back

t/10-cast_arguments.t  view on Meta::CPAN

use strict;
use warnings;
use utf8;

use Test::Most tests => 1;

=encoding utf8

=head1 NAME

Cast from native types to perl types back and fort

=head1 TESTS

=cut

BEGIN {
    use_ok('AI::XGBoost::CAPI::RAW');
}



( run in 1.180 second using v1.01-cache-2.11-cpan-df04353d9ac )