ML functions
 
Loading...
Searching...
No Matches
ml::XGBoostPrediction Class Reference

A machine learning function for making predictions using XGBoost models. More...

#include <XGBoost.h>

Inheritance diagram for ml::XGBoostPrediction:
MLFunction

Public Member Functions

 XGBoostPrediction (std::string forestPath, int numFeatures)
 Construct a new XGBoostPrediction object.
 
void apply (const SelectivityVector &rows, std::vector< VectorPtr > &args, const TypePtr &type, exec::EvalCtx &context, VectorPtr &output) const override
 Apply the function to make predictions.
 
float * getTensor () const override
 Get the tensor data.
 
int getNumFeatures ()
 Get the number of features.
 
std::string & getForestPath ()
 Get the path to the XGBoost model file.
 
- Public Member Functions inherited from MLFunction
virtual ~MLFunction ()=default
 Virtual destructor.
 
virtual std::vector< int > getDims ()
 Returns the dimensions of the function.
 
virtual std::string getFuncName ()
 Returns the name of the function.
 
virtual int getNumDims ()
 Returns the number of dimensions of the function.
 
virtual CostEstimate getCost (std::vector< int > inputDims)
 Estimates the computational cost of applying the function.
 

Static Public Member Functions

static std::vector< std::shared_ptr< exec::FunctionSignature > > signatures ()
 Get the function signatures.
 
static std::string getName ()
 Get the name of the function.
 

Additional Inherited Members

- Protected Member Functions inherited from MLFunction
double getWeightedCost (std::string name, float cost)
 Calculates the weighted cost of the function.
 
std::vector< double > getCoefficientVector (std::string name)
 Retrieves the cost coefficients for the function.
 
- Protected Attributes inherited from MLFunction
std::vector< int > dims
 Dimensions of the function.
 

Detailed Description

A machine learning function for making predictions using XGBoost models.

Constructor & Destructor Documentation

◆ XGBoostPrediction()

ml::XGBoostPrediction::XGBoostPrediction ( std::string forestPath,
int numFeatures )
inline

Construct a new XGBoostPrediction object.

Parameters
forestPathThe path to the XGBoost model file.
numFeaturesThe number of features in the input data.

Member Function Documentation

◆ apply()

void ml::XGBoostPrediction::apply ( const SelectivityVector & rows,
std::vector< VectorPtr > & args,
const TypePtr & type,
exec::EvalCtx & context,
VectorPtr & output ) const
inlineoverride

Apply the function to make predictions.

Parameters
rowsThe selectivity vector indicating which rows to process.
argsThe input arguments to the function.
typeThe type of the output vector.
contextThe evaluation context.
outputThe output vector where the results will be stored.

◆ getForestPath()

std::string & ml::XGBoostPrediction::getForestPath ( )
inline

Get the path to the XGBoost model file.

Returns
A reference to the path string.

◆ getName()

static std::string ml::XGBoostPrediction::getName ( )
inlinestatic

Get the name of the function.

Returns
A string representing the name of the function.

◆ getNumFeatures()

int ml::XGBoostPrediction::getNumFeatures ( )
inline

Get the number of features.

Returns
The number of features in the input data.

◆ getTensor()

float * ml::XGBoostPrediction::getTensor ( ) const
inlineoverridevirtual

Get the tensor data.

Returns
A pointer to the tensor data.
Note
This implementation may lead to a memory leak.

Implements MLFunction.

◆ signatures()

static std::vector< std::shared_ptr< exec::FunctionSignature > > ml::XGBoostPrediction::signatures ( )
inlinestatic

Get the function signatures.

Returns
A vector of shared pointers to function signatures.

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