src.fairreckitlib.data.split.split_event
This module contains event args and a print function for a rating conversion event.
Classes:
SplitDataframeEventArgs: event args related to splitting dataframes.
Functions:
print_split_event_args: print dataframe split event arguments.
This program has been developed by students from the bachelor Computer Science at Utrecht University within the Software Project course. © Copyright Utrecht University (Department of Information and Computing Sciences)
1"""This module contains event args and a print function for a rating conversion event. 2 3Classes: 4 5 SplitDataframeEventArgs: event args related to splitting dataframes. 6 7Functions: 8 9 print_split_event_args: print dataframe split event arguments. 10 11This program has been developed by students from the bachelor Computer Science at 12Utrecht University within the Software Project course. 13© Copyright Utrecht University (Department of Information and Computing Sciences) 14""" 15 16from dataclasses import dataclass 17 18from ...core.events.event_dispatcher import EventArgs 19from .split_config import SplitConfig 20 21 22@dataclass 23class SplitDataframeEventArgs(EventArgs): 24 """Split dataframe Event Arguments. 25 26 event_id: the unique ID that classifies the splitting event. 27 split_config: the splitting configuration that is used. 28 """ 29 30 split_config: SplitConfig 31 32 33def print_split_event_args(event_args: SplitDataframeEventArgs, elapsed_time: float=None) -> None: 34 """Print split dataframe event arguments. 35 36 It is assumed that the event started when elapsed_time is None and is finished otherwise. 37 38 Args: 39 event_args: the arguments to print. 40 elapsed_time: the time that has passed since the splitting started, expressed in seconds. 41 """ 42 if elapsed_time is None: 43 print('Splitting dataframe:', event_args.split_config.get_split_ratio_string(), 44 '=>', event_args.split_config.name) 45 else: 46 print(f'Split dataframe in {elapsed_time:1.4f}s')
23@dataclass 24class SplitDataframeEventArgs(EventArgs): 25 """Split dataframe Event Arguments. 26 27 event_id: the unique ID that classifies the splitting event. 28 split_config: the splitting configuration that is used. 29 """ 30 31 split_config: SplitConfig
Split dataframe Event Arguments.
event_id: the unique ID that classifies the splitting event. split_config: the splitting configuration that is used.
def
print_split_event_args( event_args: src.fairreckitlib.data.split.split_event.SplitDataframeEventArgs, elapsed_time: float = None) -> None:
34def print_split_event_args(event_args: SplitDataframeEventArgs, elapsed_time: float=None) -> None: 35 """Print split dataframe event arguments. 36 37 It is assumed that the event started when elapsed_time is None and is finished otherwise. 38 39 Args: 40 event_args: the arguments to print. 41 elapsed_time: the time that has passed since the splitting started, expressed in seconds. 42 """ 43 if elapsed_time is None: 44 print('Splitting dataframe:', event_args.split_config.get_split_ratio_string(), 45 '=>', event_args.split_config.name) 46 else: 47 print(f'Split dataframe in {elapsed_time:1.4f}s')
Print split dataframe event arguments.
It is assumed that the event started when elapsed_time is None and is finished otherwise.
Args: event_args: the arguments to print. elapsed_time: the time that has passed since the splitting started, expressed in seconds.