Core#

Core provides various utilities and entry points for the _aucurriculum_ toolkit.

Entry Point#

The main training entry point for aucurriculum serving as an overlay of autrainer.main.

aucurriculum.main(config_name, config_path=None, version_base=None)[source]#

Hydra main decorator with additional aucurriculum and autrainer configs.

The conf directory in the current working directory is always added to the search path if it exists. The current working directory is also added to the Python path.

Parameters:
  • config_name (str) – The name of the config (usually the file name without the .yaml extension).

  • config_path (Optional[str]) – The config path, a directory where Hydra will search for config files. If config_path is None no directory is added to the search path. Defaults to None.

  • version_base (Optional[str]) – Hydra version base. Defaults to None.

Filters#

To automatically filter out the placeholder scoring function or partial curricula, aucurriculum provides default filters which extend the hydra-filter-sweeper plugin.

class aucurriculum.core.filters.FilterPlaceholderScoringFunction[source]#
filter(config, directory)[source]#

Filter out run configurations with placeholder (None) scoring functions.

Parameters:
  • config (DictConfig) – Run configuration.

  • directory (str) – Directory where the run configuration is stored.

Return type:

bool

Returns:

Whether to filter out the run configuration.

class aucurriculum.core.filters.FilterPartialCurriculum[source]#
filter(config, directory)[source]#

Filter out run configurations with partial curricula. A partial curriculum is one where the id is not “None” but one or more of the sampling, scoring, and pacing ids are “None”.

Parameters:
  • config (DictConfig) – Run configuration.

  • directory (str) – Directory where the run configuration is stored.

Return type:

bool

Returns:

Whether to filter out the run configuration.

Plotting#

Plotting provides a simple interface extending the autrainer plotting utilities to additionally plot the dynamic dataset size of the curriculum.

class aucurriculum.core.plotting.CurriculumPlots(output_directory, training_type, figsize, latex, filetypes, pickle, context, palette, replace_none, add_titles, add_xlabels, add_ylabels, rcParams)[source]#

Plot the sample difficulty scores and pace of curricula.

Parameters:
  • output_directory (str) – Output directory to save plots to.

  • training_type (str) – Type of training in [“Epoch”, “Step”].

  • figsize (tuple) – Figure size in inches.

  • latex (bool) – Whether to use LaTeX in plots. Requires the latex package. To install all necessary dependencies, run: pip install autrainer[latex].

  • filetypes (list) – Filetypes to save plots as.

  • pickle (bool) – Whether to save additional pickle files of the plots.

  • context (str) – Context for seaborn plots.

  • palette (str) – Color palette for seaborn plots.

  • replace_none (bool) – Whether to replace “None” in labels with “~”.

  • add_titles (bool) – Whether to add titles to plots.

  • add_xlabels (bool) – Whether to add x-labels to plots.

  • add_ylabels (bool) – Whether to add y-labels to plots.

  • rcParams (dict) – Additional Matplotlib rcParams to set.

plot_score(df, score_id, num_bins=20)[source]#

Plot the sample difficulty scores by creating histograms, facet grids, and ridge plots visualizing the global and per class sample difficulty distributions.

Parameters:
  • df (DataFrame) – DataFrame containing the sample difficulty scores (“mean”,

  • labels ("ranks") and corresponding)

  • score_id (str) – ID of the scoring function.

  • num_bins – Number of bins for the histogram. Defaults to 20.

Return type:

None

plot_correlation_matrix(df, name)[source]#

Create and plot the correlation matrix of the scoring functions.

Parameters:
  • df (DataFrame) – DataFrame containing multiple scoring functions per column.

  • name (str) – Name of the correlation matrix plot.

Return type:

None

plot_run(df)[source]#

Plot the dynamic dataset size determined by the curriculum.

Parameters:

df (DataFrame) – DataFrame containing the run metrics and dataset sizes.

Return type:

None

plot_pace(df)[source]#

Plot the dynamic dataset size of multiple runs.

Parameters:

df (DataFrame) – DataFrame containing multiple runs and their dataset sizes.

Return type:

None

Constants#

aucurriculum extends the default autrainer.constants with additional constants for the curriculum.

class aucurriculum.core.constants.CurriculumConstants[source]#

Singleton for managing the curriculum configurations of aucurriculum.

property CONFIG_DIRS: List[str]#

Get the curriculum configuration directories for Hydra configurations. Defaults to ["curriculum", "curriculum/pacing", "curriculum/sampling", "curriculum/scoring"].

Returns:

Curriculum configuration directories for Hydra configurations.