ts_benchmark.utils package

Subpackages

ts_benchmark.utils.compress module

Functions

compress(data[, method])

compress_gz(data)

Compress in gz format

compress_gzip(data)

Compress data using Gzip compression.

decompress(data[, method])

decompress_gz(data)

decompress_gzip(compressed_data)

Decompress Gzip-compressed data and return the original dictionary.

get_compress_file_ext(method)

get_compress_method_from_ext(ext)

compress(data: Dict[str, str], method: str = 'gz') bytes[source]
compress_gz(data: Dict[str, str]) bytes[source]

Compress in gz format

compress_gzip(data: Dict[str, str]) bytes[source]

Compress data using Gzip compression.

decompress(data: bytes, method: str = 'gz') Dict[str, str][source]
decompress_gz(data: bytes) Dict[str, str][source]
decompress_gzip(compressed_data: bytes) Dict[str, str][source]

Decompress Gzip-compressed data and return the original dictionary.

get_compress_file_ext(method: str) str[source]
get_compress_method_from_ext(ext: str) str | None[source]

ts_benchmark.utils.data_processing module

Functions

split_before(data, index)

Split time series data into two parts at the specified index.

split_before(data: pandas.DataFrame, index: int) Tuple[pandas.DataFrame, pandas.DataFrame][source]

Split time series data into two parts at the specified index.

Parameters:
  • data – Time series data to be segmented.

  • index – Split index position.

Returns:

Split the first and second half of the data.

ts_benchmark.utils.design_pattern module

Classes

Singleton

Used to construct singleton classes through the method of meta classes

class Singleton[source]

Bases: type

Used to construct singleton classes through the method of meta classes

ts_benchmark.utils.get_file_name module

Functions

get_unique_file_suffix()

Generate a log file name suffix that includes the following information:

get_unique_file_suffix()[source]

Generate a log file name suffix that includes the following information:

  • Hostname

  • The current timestamp, in seconds, is the number of seconds since the Unix era

  • PID (process identifier) of the process

Return: str: The name of the generated log file, in the format ‘.timestamp.hostname.pid.csv’

For example, if the host name is’ myhost ‘, the current timestamp is 1631655702, and the current process ID is 12345 The returned file name may be ‘.1631655702.myhost.12345.csv’.

ts_benchmark.utils.random_utils module

Functions

fix_all_random_seed([seed])

Fixes the random seed for Python, PyTorch, NumPy, and CUDA.

fix_random_seed([seed])

Fixes the random seed for Python, PyTorch, and NumPy to ensure reproducibility.

fix_all_random_seed(seed: int | None = 2021) NoReturn[source]

Fixes the random seed for Python, PyTorch, NumPy, and CUDA.

Parameters:

seed – The seed value to be used for random number generation.

Returns:

None

fix_random_seed(seed: int | None = 2021) NoReturn[source]

Fixes the random seed for Python, PyTorch, and NumPy to ensure reproducibility.

Parameters:

seed – The seed value to be used for random number generation.

Returns:

None