AI-XGBoost
view release on metacpan or search on metacpan
lib/AI/XGBoost/DMatrix.pm view on Meta::CPAN
sub get_weight {
my $self = shift();
$self->get_float_info('weight');
}
sub set_base_margin {
my $self = shift();
my $margin = shift();
$self->set_float_info( 'base_margin', $margin );
return $self;
}
sub get_base_margin {
my $self = shift();
$self->get_float_info('base_margin');
}
sub set_group {
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
( run in 1.357 second using v1.01-cache-2.11-cpan-437f7b0c052 )