scaling

Functionality for scaling data like SIMCA.

friendly_mvda.scaling.scale_data(data: DataFrame, centering_type: str, scaling_type: str, primary_id: str, secondary_ids: list[str] | None = None) tuple[list[str], list[float], DataFrame]

Scale the data using the specified centering and scaling types.

parameters: data: DataFrame

The data to be scaled.

centering_type: str

The centering type to be used. Options are “Ctr” for mean centering or any other value for no centering.

scaling_type: str

The scaling type to be used. Options are “UV” for unit variance scaling, “Pareto” for Pareto scaling, or any other value for no scaling.

primary_id: str

The name of the primary observation ID column.

secondary_ids: list[str] | None

The names of the secondary observation ID columns.

Returns the scale type and scale weights.

friendly_mvda.scaling.scale_with_reference(data: DataFrame, reference_data: DataFrame, centering_type: str, scaling_type: str, primary_id: str, secondary_ids: list[str] | None) tuple[list[str], list[float], DataFrame]

Scale the data using the specified centering and scaling types with reference data.

works like scale_data but uses reference data for calculating the scaling weights.

Returns the scale type and scale weights.

friendly_mvda.scaling.update_transformed_data_names(transformed_data: DataFrame, original_data: DataFrame, primary_id: str, secondary_ids: list[str] | None = None) DataFrame

Update the names of the transformed data to match the original data. This function ensures that the transformed data has the same column names as the original data,