StandardizeComputer
StandardizeComputer
Computer that standardizes (Z-scores) a numerical column. More…
#include <StandardizeComputer.h>
Inherits from IColumnComputer< double >
Public Functions
| Name | |
|---|---|
| StandardizeComputer(std::string dependency_col_name) Constructor. |
|
| virtual std::vector< std::string > | getDependencies() const override Returns the dependencies of this computer. |
| virtual std::string | getSourceDependency() const override Returns the source dependency (empty for dependency-based computers). |
| virtual std::pair< std::vector< double >, ColumnEntityIds > | compute(const ExecutionPlan & plan) const override Computes the standardized values. |
| std::vector< double > | computeFromData(const std::vector< T > & source_values) const Computes standardized values from source data. |
Additional inherited members
Public Functions inherited from IColumnComputer< double >
| Name | |
|---|---|
| virtual | ~IColumnComputer() =default |
| IColumnComputer(IColumnComputer const & ) =delete | |
| IColumnComputer & | operator=(IColumnComputer const & ) =delete |
| IColumnComputer(IColumnComputer && ) =delete | |
| IColumnComputer & | operator=(IColumnComputer && ) =delete |
| virtual EntityIdStructure | getEntityIdStructure() const Gets the EntityID structure type for this computer. |
| virtual ColumnEntityIds | computeColumnEntityIds(ExecutionPlan const & plan) const Computes all EntityIDs for the column using the high-level variant approach. |
| virtual std::vector< EntityId > | computeCellEntityIds(ExecutionPlan const & plan, size_t row_index) const Computes EntityIDs for a specific row. |
| virtual bool | hasEntityIds() const Checks if this computer can provide EntityID information. |
Protected Functions inherited from IColumnComputer< double >
| Name | |
|---|---|
| IColumnComputer() =default |
Detailed Description
template <typename T >
class StandardizeComputer;Computer that standardizes (Z-scores) a numerical column.
Template Parameters:
- T The input column type (typically double or float)
Source type: IAnalogSource Selector type: Timestamp Output type: double
This computer takes a single column name as a dependency and produces a standardized version where each value is transformed to: z = (x - mean) / stddev
The computer calculates the mean and standard deviation of the entire source column, then applies the standardization formula element-wise.
This computer demonstrates column-to-column dependency handling, where the output depends on the materialized data of another column rather than directly on a data source.
Public Functions Documentation
function StandardizeComputer
explicit StandardizeComputer(
std::string dependency_col_name
)Constructor.
Parameters:
- dependency_col_name Name of the column to standardize.
function getDependencies
virtual std::vector< std::string > getDependencies() const overrideReturns the dependencies of this computer.
Return: Vector containing the single dependency column name.
Reimplements: IColumnComputer::getDependencies
function getSourceDependency
virtual std::string getSourceDependency() const overrideReturns the source dependency (empty for dependency-based computers).
Return: Empty string since this computer depends on other columns, not data sources.
Reimplements: IColumnComputer::getSourceDependency
function compute
virtual std::pair< std::vector< double >, ColumnEntityIds > compute(
const ExecutionPlan & plan
) const overrideComputes the standardized values.
Parameters:
- plan The execution plan (unused for dependency-based computers).
Return: Vector of standardized double values.
Reimplements: IColumnComputer::compute
Note: This method currently serves as a placeholder. The actual computation will be handled by the TableView system calling computeFromData with the materialized dependency data.
function computeFromData
std::vector< double > computeFromData(
const std::vector< T > & source_values
) constComputes standardized values from source data.
Parameters:
- source_values The values from the dependency column.
Return: Vector of standardized double values.
This method takes the source data directly and performs standardization:
- Calculates the mean of all values
- Calculates the standard deviation
- Applies z = (x - mean) / stddev to each value
- Handles edge cases (empty data, zero standard deviation)
Updated on 2026-11-13 at 20:25:39 +0000