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

Interface for Parser. More...

#include <dataset.h>

Inheritance diagram for LightGBM::Parser:
LightGBM::CSVParser LightGBM::LibSVMParser LightGBM::TSVParser

Public Member Functions

virtual ~Parser ()
 virtual destructor
 
virtual void ParseOneLine (const char *str, std::vector< std::pair< int, double > > *out_features, double *out_label) const =0
 Parse one line with label.
 
virtual int TotalColumns () const =0
 

Static Public Member Functions

static ParserCreateParser (const char *filename, bool header, int num_features, int label_idx)
 Create a object of parser, will auto choose the format depend on file.
 

Detailed Description

Interface for Parser.

Member Function Documentation

◆ CreateParser()

Parser * LightGBM::Parser::CreateParser ( const char *  filename,
bool  header,
int  num_features,
int  label_idx 
)
static

Create a object of parser, will auto choose the format depend on file.

Parameters
filenameOne Filename of data
num_featuresPass num_features of this data file if you know, <=0 means don't know
label_idxindex of label column
Returns
Object of parser

◆ ParseOneLine()

virtual void LightGBM::Parser::ParseOneLine ( const char *  str,
std::vector< std::pair< int, double > > *  out_features,
double *  out_label 
) const
pure virtual

Parse one line with label.

Parameters
strOne line record, string format, should end with '\0'
out_featuresOutput columns, store in (column_idx, values)
out_labelLabel will store to this if exists

Implemented in LightGBM::CSVParser, LightGBM::TSVParser, and LightGBM::LibSVMParser.


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