A base class for machine learning functions, inheriting from Velox's VectorFunction. More...
#include <BaseFunction.h>
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. | |
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.
|
inlineprotected |
Retrieves the cost coefficients for the function.
| name | The name of the function. |
|
inlinevirtual |
Estimates the computational cost of applying the function.
| inputDims | A vector containing the dimensions of the input. |
Reimplemented in Argmax, BatchNorm1D, ChatGPT, ChatGPTRecommender, Concat, CosineSimilarity, DateToTimestamp, DotProduct, GetAge, GetBinaryClass, GetCustomerFeatures, GetTransactionFeatures, HuggingFaceServerless, HuggingFaceTokenizer, IntEncoder, IsWeekday, MatrixAddition, MatrixMultiply, MatrixMultiply_h, MinMaxScaler, ml::TreePrediction, ml::VeloxTreePrediction, MultiHotNormalizedEncoder, PositionEncoding, RAG, Relu, SequencePooling, Sigmoid, Softmax, StringEncoder, StringVariadicEncoder, SVD, TimeDiffInDays, TorchDNN2Level, TorchDNN, TorchDNNV2, and TorchDNNV2CUDA.
|
inlinevirtual |
Returns the dimensions of the function.
|
inlinevirtual |
Returns the name of the function.
Reimplemented in Argmax, Convolute, MatrixAddition, MatrixMultiply, MatrixMultiply_b, MatrixMultiply_Block, MatrixMultiply_h, MatrixVectorAddition, MaxPool, MinMaxScaler, ml::TreePrediction, ml::VeloxTreePrediction, RAG, Relu, Sigmoid, Softmax, SVD, TorchCNN, TorchConvolute, TorchDNN2Level, TorchDNN, TorchDNNKernel, TorchDNNV2, TorchDNNV2CUDA, and VectorScalarAddition.
|
inlinevirtual |
Returns the number of dimensions of the function.
|
pure virtual |
Returns the tensor associated with this function.
Implemented in 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_b, MatrixMultiply_Block, MatrixMultiply_h, MatrixVectorAddition, MatrixVectorAddition, MaxPool, MinMaxScaler, ml::TreePrediction, ml::VeloxTreePrediction, ml::XGBoostPrediction, MultiHotNormalizedEncoder, PositionEncoding, RAG, Relu, SequencePooling, Sigmoid, Softmax, StringEncoder, StringVariadicEncoder, SVD, TimeDiffInDays, TorchCNN, TorchConvolute, TorchDNN2Level, TorchDNN, TorchDNN_Multi, TorchDNNKernel, TorchDNNV2, TorchDNNV2CUDA, and VectorScalarAddition.
|
inlineprotected |
Calculates the weighted cost of the function.
| name | The name of the function. |
| cost | The base cost of the function. |