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

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

#include <VeloxDecisionTree.h>

Inheritance diagram for ml::VeloxTreePrediction:
MLFunction

Public Member Functions

 VeloxTreePrediction (int numFeatures)
 Construct a new VeloxTreePrediction object.
 
float * getTensor () const override
 Get the tensor data.
 
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.
 
std::string getFuncName ()
 Get the function name.
 
CostEstimate getCost (std::vector< int > inputDims)
 Get the cost estimate for the function.
 
- Public Member Functions inherited from MLFunction
virtual ~MLFunction ()=default
 Virtual destructor.
 
virtual std::vector< int > getDims ()
 Returns the dimensions of the function.
 
virtual int getNumDims ()
 Returns the number of dimensions of 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.
 

Public Attributes

int numFeatures
 The number of features in the input data.
 

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 tree models.

Constructor & Destructor Documentation

◆ VeloxTreePrediction()

ml::VeloxTreePrediction::VeloxTreePrediction ( int numFeatures)
inline

Construct a new VeloxTreePrediction object.

Parameters
numFeaturesThe number of features in the input data.

Member Function Documentation

◆ apply()

void ml::VeloxTreePrediction::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.

◆ getCost()

CostEstimate ml::VeloxTreePrediction::getCost ( std::vector< int > inputDims)
inlinevirtual

Get the cost estimate for the function.

Parameters
inputDimsThe dimensions of the input data.
Returns
A CostEstimate object representing the cost.

Reimplemented from MLFunction.

◆ getFuncName()

std::string ml::VeloxTreePrediction::getFuncName ( )
inlinevirtual

Get the function name.

Returns
A string representing the function name.

Reimplemented from MLFunction.

◆ getName()

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

Get the name of the function.

Returns
A string representing the name of the function.

◆ getTensor()

float * ml::VeloxTreePrediction::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::VeloxTreePrediction::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: