AI-XGBoost
view release on metacpan or search on metacpan
lib/AI/XGBoost/DMatrix.pm view on Meta::CPAN
my $self = shift();
my $group = shift();
XGDMatrixSetGroup( $self->handle, $group );
return $self;
}
sub num_row {
my $self = shift();
XGDMatrixNumRow( $self->handle );
}
sub num_col {
my $self = shift();
XGDMatrixNumCol( $self->handle );
}
sub dims {
my $self = shift();
return ( $self->num_row(), $self->num_col() );
}
sub slice {
my $self = shift;
my ($list_of_indices) = @_;
my $handle = XGDMatrixSliceDMatrix( $self->handle(), $list_of_indices );
return __PACKAGE__->new( handle => $handle );
}
sub DEMOLISH {
my $self = shift();
XGDMatrixFree( $self->handle );
}
__PACKAGE__->meta->make_immutable();
1;
__END__
=pod
=encoding utf-8
=head1 NAME
AI::XGBoost::DMatrix - XGBoost class for data
=head1 VERSION
version 0.11
=head1 SYNOPSIS
use aliased 'AI::XGBoost::DMatrix';
my $train_data = DMatrix->FromFile(filename => 'agaricus.txt.train');
=head1 DESCRIPTION
XGBoost DMatrix perl model
Work In Progress, the API may change. Comments and suggestions are welcome!
=head1 METHODS
=head2 From
Construct a DMatrix from diferent sources. Based on parameters
dispatch to the correct From* method
Refer to From* to see what can be done.
=head2 FromFile
Construct a DMatrix from a file
=head3 Parameters
=over 4
=item filename
File to read
=item silent
Supress messages
=back
=head2 FromMat
Construct a DMatrix from a bidimensional array
=head3 Parameters
=over 4
=item matrix
Bidimensional array
=item label
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
( run in 2.564 seconds using v1.01-cache-2.11-cpan-13bb782fe5a )