baybe.utils.augmentation.df_apply_mirror_augmentation

baybe.utils.augmentation.df_apply_mirror_augmentation(df: DataFrame, column: str, *, mirror_point: float = 0.0)[source]

Augment a dataframe for a mirror invariant column.

Parameters:
  • df (DataFrame) – The dataframe that should be augmented.

  • column (str) – The name of the affected column.

  • mirror_point (float) – The point along which to mirror the values. Points that have exatly this value will not be augmented.

Return type:

DataFrame

Returns:

The augmented dataframe containing the original one. Augmented row indices are identical with the index of their original row.

Examples

>>> df = pd.DataFrame({'A':[1, 0, -2], 'B': [3, 4, 5]})
>>> df
   A  B
0  1  3
1  0  4
2 -2  5
>>> dfa = df_apply_mirror_augmentation(df, "A")
>>> dfa
   A  B
0  1  3
0 -1  3
1  0  4
2 -2  5
2  2  5
>>> dfa = df_apply_mirror_augmentation(df, "A", mirror_point=1)
>>> dfa
   A  B
0  1  3
1  0  4
1  2  4
2 -2  5
2  4  5