Implementation of utility functions and classes for machine learning tasks.
More...
#include <Eigen/Dense>
#include <cmath>
#include <filesystem>
#include <iostream>
#include "BaseFunction.h"
#include "velox/exec/tests/utils/AssertQueryBuilder.h"
#include "velox/exec/tests/utils/PlanBuilder.h"
#include "velox/exec/tests/utils/TempDirectoryPath.h"
#include "velox/vector/tests/utils/VectorTestBase.h"
Go to the source code of this file.
|
| std::string | LoadBytesFromFile (const std::string &path) |
| | Loads bytes from a file into a string.
|
| |
| bool | stringToBool (const std::string &str) |
| | Converts a string to a boolean value.
|
| |
| std::string | getEnvVar (std::string const &key) |
| | Retrieves the value of an environment variable.
|
| |
| void | readDataStats (const std::string &path, int &numRows, int &numCols) |
| | Reads the number of rows and columns from a data statistics file.
|
| |
| template<typename T> |
| T * | flattenVectorToPointer (const std::vector< std::vector< T > > &vec2D, size_t &totalSize) |
| | Flattens a 2D vector into a 1D array.
|
| |
| template<typename T> |
| T * | flattenVectorToPointer (const std::vector< std::vector< T > > &vec2D) |
| | Flattens a 2D vector into a 1D array (overloaded version without totalSize).
|
| |
| int | countWords (const std::string &input) |
| | Counts the number of words in a string.
|
| |
Implementation of utility functions and classes for machine learning tasks.
- Copyright
- Copyright (c) 2025 ASU Cactus Lab. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
◆ countWords()
| int countWords |
( |
const std::string & | input | ) |
|
Counts the number of words in a string.
- Parameters
-
- Returns
- The number of words in the string.
◆ flattenVectorToPointer() [1/2]
template<typename T>
| T * flattenVectorToPointer |
( |
const std::vector< std::vector< T > > & | vec2D | ) |
|
Flattens a 2D vector into a 1D array (overloaded version without totalSize).
- Template Parameters
-
| T | The type of elements in the vector. |
- Parameters
-
| vec2D | The 2D vector to flatten. |
- Returns
- A pointer to the flattened array.
◆ flattenVectorToPointer() [2/2]
template<typename T>
| T * flattenVectorToPointer |
( |
const std::vector< std::vector< T > > & | vec2D, |
|
|
size_t & | totalSize ) |
Flattens a 2D vector into a 1D array.
- Template Parameters
-
| T | The type of elements in the vector. |
- Parameters
-
| vec2D | The 2D vector to flatten. |
| totalSize | Reference to store the total size of the flattened array. |
- Returns
- A pointer to the flattened array.
◆ getEnvVar()
| std::string getEnvVar |
( |
std::string const & | key | ) |
|
Retrieves the value of an environment variable.
- Parameters
-
| key | The name of the environment variable. |
- Returns
- The value of the environment variable, or an empty string if not found.
◆ LoadBytesFromFile()
| std::string LoadBytesFromFile |
( |
const std::string & | path | ) |
|
Loads bytes from a file into a string.
- Parameters
-
- Returns
- A string containing the file's contents.
◆ readDataStats()
| void readDataStats |
( |
const std::string & | path, |
|
|
int & | numRows, |
|
|
int & | numCols ) |
Reads the number of rows and columns from a data statistics file.
- Parameters
-
| path | Path to the data statistics file. |
| numRows | Reference to store the number of rows. |
| numCols | Reference to store the number of columns. |
◆ stringToBool()
| bool stringToBool |
( |
const std::string & | str | ) |
|
Converts a string to a boolean value.
- Parameters
-
| str | The string to convert. |
- Returns
- The boolean value corresponding to the string.