bursty_dynamics.scores
This module contains functions for caluclating the BP and the MC per subject id using the calculate_scores function.
- bursty_dynamics.scores.calculate_scores(df, subject_id, time_col, scatter=False, hist=False, hue=None)
Calculate burstiness parameter and memory coefficient.
Parameters
- dfDataFrame
Input DataFrame.
- subject_idstr
Name of the column containing subject IDs.
- time_colstr
Name of the column containing the date.
- scatterbool, optional
Whether to plot scatter plot. Default is False.
- histbool or str, optional
- Type of histogram to plot:
True: Plot histograms for both Burstiness Parameter (BP) and Memory Coefficient (MC).
"BP": Plot histogram for Burstiness Parameter only.
"MC": Plot histogram for Memory Coefficient only.
"Both": Plot histograms for both BP and MC on the same plot.
False or None: Do not plot any histograms. Default is False.
Returns
- tuple or DataFrame
If both scatter and hist are True: returns (merged_df, scatter_plot, hist_plot). If only scatter is True: returns (merged_df, scatter_plot). If only hist is True: returns (merged_df, hist_plot). If neither scatter nor hist is True: returns merged_df.
Notes
- merged_dfDataFrame
The input DataFrame with added columns for burstiness parameter (BP) and memory coefficient (MC) scores.
- scatter_plotmatplotlib.figure.Figure or None
The figure object containing the scatter plot (if scatter=True).
- hist_plotsmatplotlib.figure.Figure or None
The figure objects containing the histogram (if hist=True).
Multiple events occurring at the same time will be aggregated into a single event.