ML functions
 
Loading...
Searching...
No Matches
MLFunction Class Referenceabstract

A base class for machine learning functions, inheriting from Velox's VectorFunction. More...

#include <BaseFunction.h>

Inheritance diagram for MLFunction:
Argmax BatchNorm1D ChangeRating ChatGPT ChatGPTRecommender Concat ConvertDoubleArrayToFloatArray ConvertDoubleToFloatArray ConvertToFloatArray ConvertToIntArray Convolute CosineSimilarity DateToTimestamp DotProduct Dropout Embedding FullyConnectWithBatchNormAndRelu GetAge GetBinaryClass GetCustomerFeatures GetTransactionFeatures HuggingFaceServerless HuggingFaceTokenizer IntEncoder IsWeekday MatrixAddition MatrixMultiply MatrixMultiply_Block MatrixMultiply_b MatrixMultiply_h MatrixVectorAddition MaxPool MinMaxScaler MultiHotNormalizedEncoder PositionEncoding RAG Relu SVD SequencePooling Sigmoid Softmax StringEncoder StringVariadicEncoder TimeDiffInDays TorchCNN TorchConvolute TorchDNN TorchDNN2Level TorchDNNKernel TorchDNNV2 TorchDNNV2CUDA TorchDNN_Multi VectorScalarAddition ml::TreePrediction ml::VeloxTreePrediction ml::XGBoostPrediction

Public Member Functions

virtual ~MLFunction ()=default
 Virtual destructor.
 
virtual float * getTensor () const =0
 Returns the tensor associated with this function.
 
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.
 

Protected Member Functions

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

std::vector< int > dims
 Dimensions of the function.
 

Detailed Description

A base class for machine learning functions, inheriting from Velox's VectorFunction.

This class provides a common interface for machine learning functions, including methods for retrieving tensors, dimensions, and cost estimates. It also includes utility methods for calculating weighted costs and retrieving cost coefficients.

Member Function Documentation

◆ getCoefficientVector()

std::vector< double > MLFunction::getCoefficientVector ( std::string name)
inlineprotected

Retrieves the cost coefficients for the function.

Parameters
nameThe name of the function.
Returns
A vector of cost coefficients.

◆ getCost()

virtual CostEstimate MLFunction::getCost ( std::vector< int > inputDims)
inlinevirtual

◆ getDims()

virtual std::vector< int > MLFunction::getDims ( )
inlinevirtual

Returns the dimensions of the function.

Returns
A vector containing the dimensions.

◆ getFuncName()

virtual std::string MLFunction::getFuncName ( )
inlinevirtual

◆ getNumDims()

virtual int MLFunction::getNumDims ( )
inlinevirtual

Returns the number of dimensions of the function.

Returns
The number of dimensions.

◆ getTensor()

◆ getWeightedCost()

double MLFunction::getWeightedCost ( std::string name,
float cost )
inlineprotected

Calculates the weighted cost of the function.

Parameters
nameThe name of the function.
costThe base cost of the function.
Returns
The weighted cost as a double.

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