phlower.services.preprocessing.PhlowerScalingService¶
- class phlower.services.preprocessing.PhlowerScalingService(scaling_setting)[source]¶
Bases:
object
PhlowerScalingService is a class that provides a service for scaling.
Examples
>>> scaling_service = PhlowerScalingService.from_yaml("scaling.yaml") >>> scaling_service.fit_transform_all( ... interim_data_directories, ... output_base_directory, ... )
Methods
__init__
(scaling_setting)fit_transform_all
(interim_data_directories, ...)This function is consisted of these three process.
from_setting
(setting)Create PhlowerScalingService from PhlowerSetting
from_yaml
(yaml_file[, decrypt_key])Create PhlowerScalingService from yaml file
inverse_transform
(dict_data[, ...])Inverse transform data
lazy_fit_all
(data_directories, *[, ...])Fit scalers by reading data files lazily
save
(output_directory, file_base_name[, ...])Save Parameters of scaling converters
transform
()- Parameters:
scaling_setting (PhlowerScalingSetting)
- fit_transform_all(interim_data_directories, output_base_directory, max_process=None, allow_missing=False, allow_overwrite=False, decrypt_key=None, encrypt_key=None)[source]¶
This function is consisted of these three process. - Determine parameters of scalers by reading data files lazily - Transform interim data and save result - Save file of parameters
- Return type:
None
- Parameters:
interim_data_directories (list[Path])
output_base_directory (Path)
max_process (int | None)
allow_missing (bool)
allow_overwrite (bool)
decrypt_key (bytes | None)
encrypt_key (bytes | None)
- classmethod from_setting(setting)[source]¶
Create PhlowerScalingService from PhlowerSetting
- Parameters:
setting (PhlowerSetting) – PhlowerSetting PhlowerSetting
- Returns:
PhlowerScalingService
- Return type:
- classmethod from_yaml(yaml_file, decrypt_key=None)[source]¶
Create PhlowerScalingService from yaml file
- Parameters:
yaml_file (str | Path) – str | pathlib.Path Yaml file
decrypt_key (bytes | None) – bytes | None Decrypt key If None, do not decrypt.
- Returns:
PhlowerScalingService
- Return type:
- inverse_transform(dict_data, raise_missing_message=False)[source]¶
Inverse transform data
- Parameters:
dict_data (dict[str, ndarray | coo_matrix | csr_matrix | csc_matrix | csr_array | coo_array | csc_array | IPhlowerArray]) – dict[str, ArrayDataType | IPhlowerArray] Dictionary of variable names and data
raise_missing_message (bool) – bool If True, raise message when missing variables
- Returns:
dict[str, IPhlowerArray]
- Return type:
Inverse transformed data