Medial Code Documentation
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions
LightGBM::BinMapper Class Reference

This class used to convert feature values into bin, and store some meta information for bin. More...

#include <bin.h>

Public Member Functions

 BinMapper (const BinMapper &other)
 
 BinMapper (const void *memory)
 
bool CheckAlign (const BinMapper &other) const
 
int num_bin () const
 Get number of bins.
 
MissingType missing_type () const
 Missing Type.
 
bool is_trivial () const
 True if bin is trivial (contains only one bin)
 
double sparse_rate () const
 Sparsity of this bin ( num_zero_bins / num_data )
 
void SaveBinaryToFile (const VirtualFileWriter *writer) const
 Save binary data to file.
 
double BinToValue (uint32_t bin) const
 Mapping bin into feature value.
 
size_t SizesInByte () const
 Get sizes in byte of this object.
 
uint32_t ValueToBin (double value) const
 Mapping feature value into bin.
 
uint32_t GetDefaultBin () const
 Get the default bin when value is 0.
 
void FindBin (double *values, int num_values, size_t total_sample_cnt, int max_bin, int min_data_in_bin, int min_split_data, BinType bin_type, bool use_missing, bool zero_as_missing)
 Construct feature value to bin mapper according feature values.
 
void CopyTo (char *buffer) const
 Seirilizing this object to buffer.
 
void CopyFrom (const char *buffer)
 Deserilizing this object from buffer.
 
BinType bin_type () const
 Get bin types.
 
std::string bin_info () const
 Get bin info.
 

Static Public Member Functions

static int SizeForSpecificBin (int bin)
 Use specific number of bin to calculate the size of this class.
 

Detailed Description

This class used to convert feature values into bin, and store some meta information for bin.

Member Function Documentation

◆ BinToValue()

double LightGBM::BinMapper::BinToValue ( uint32_t  bin) const
inline

Mapping bin into feature value.

Parameters
bin
Returns
Feature value of this bin

◆ CopyFrom()

void LightGBM::BinMapper::CopyFrom ( const char *  buffer)

Deserilizing this object from buffer.

Parameters
bufferThe source

◆ CopyTo()

void LightGBM::BinMapper::CopyTo ( char *  buffer) const

Seirilizing this object to buffer.

Parameters
bufferThe destination

◆ FindBin()

void LightGBM::BinMapper::FindBin ( double *  values,
int  num_values,
size_t  total_sample_cnt,
int  max_bin,
int  min_data_in_bin,
int  min_split_data,
BinType  bin_type,
bool  use_missing,
bool  zero_as_missing 
)

Construct feature value to bin mapper according feature values.

Parameters
values(Sampled) values of this feature, Note: not include zero.
num_valuesnumber of values.
total_sample_cntnumber of total sample count, equal with values.size() + num_zeros
max_binThe maximal number of bin
min_data_in_binmin number of data in one bin
min_split_data
bin_typeType of this bin
use_missingTrue to enable missing value handle
zero_as_missingTrue to use zero as missing value

◆ GetDefaultBin()

uint32_t LightGBM::BinMapper::GetDefaultBin ( ) const
inline

Get the default bin when value is 0.

Returns
default bin

◆ SaveBinaryToFile()

void LightGBM::BinMapper::SaveBinaryToFile ( const VirtualFileWriter writer) const

Save binary data to file.

Parameters
fileFile want to write

◆ SizeForSpecificBin()

int LightGBM::BinMapper::SizeForSpecificBin ( int  bin)
static

Use specific number of bin to calculate the size of this class.

Parameters
binThe number of bin
Returns
Size

◆ ValueToBin()

uint32_t LightGBM::BinMapper::ValueToBin ( double  value) const
inline

Mapping feature value into bin.

Parameters
value
Returns
bin for this feature value

The documentation for this class was generated from the following files: