Developer Index

This page lists the types and functions that are internal to the CFAR package. Because they are not part of the public API, these names might change relatively frequently between versions and so should not be relied upon.

All internal names are listed in the Index, and each of these entries link to the docstrings in the Docs section.

Index

This section contains a list of internal names that link to their corresponding Documentation.

Methods

Types

Constants

Docs

Documentation for all internal names are listed below.

CFAR.ALPHABETConstant

ALPHABET

Description

Vector of alphabetical letters as Strings for discretized feature labels.

source
CFAR.ARG_PConstant

ARG_P

Description

Common docstring: argument for a split ratio p.

source
CFAR.ARG_PLOTConstant

ARG_PLOT

Description

Common docstring: argument for an existing Plots.Plot object to plot atop.

source
CFAR.ARG_SIM_DConstant

ARGSIMD

Description

Common docstring: argument for the simulation options dictionary.

source
CFAR.ARG_SIM_OPTSConstant

ARGSIMOPTS

Description

Common docstring: argument for additional simulation options.

source
CFAR.BLOCK_TYPESConstant

BLOCK_TYPES

Description

The names of the blocks that are encountered during L2 experiments.

source
CFAR.COMMON_DOCConstant

COMMON_DOC

Description

Docstring prefix denoting that the constant is used as a common docstring element for other docstrings.

source
CFAR.DPIConstant

The default plotting dots-per-inch for saving.

source
CFAR.JSON_INDENTConstant

JSON_INDENT

Description

Constant for pretty indentation spacing in JSON files.

source
CFAR.LOG_STATESConstant

LOG_STATES

Description

The enumerated states that an L2 logger log can be in.

source
CFAR.MS_GROUPConstant

MS_GROUP

Description

Constant name for the JLD2/H5 group that data is saved to and loaded from.

Arguments

  • ms::MoverSplit: the MoverSplit dataset to save.
  • filename::AbstractString: the full file path as a string.
source
CFAR.SAVE_MAPConstant

SAVE_MAP

Description

Dictionary mapping the names of result save types to the private wrapper functions that implement them.

source
CFAR.AgentType
struct Agent{T} <: CFAR.AbstractAgent

Summary

L2 AbstractAgent struct.

Fields

  • agent::Any: The DDVFA module.
  • params::Dict: Parameters used for l2logging.
  • scenario::CFAR.ExperienceQueueContainer: Container for the Experience Queue.
source
CFAR.AgentMethod

Constructor for a Agent using the scenario dictionary and optional DDVFA keyword argument options.

Arguments

  • scenario::AbstractDict: l2logger scenario as a dictionary.
source
CFAR.AgentMethod

Creates a DDVFA agent with an empty experience queue.

Arguments

  • ddvfa_opts::opts_DDVFA: the options struct used to initialize the DDVFA module and set the logging params.
source
CFAR.ConfigDictType

ConfigDict

Description

Definition of a configuration dictionary loaded from a config file.

source
CFAR.DSICType
struct DSIC <: CFAR.VectoredData

Summary

DataSplitIndexedCombined

A struct for encapsulating the components of supervised training in vectorized form.

Fields

source
CFAR.DataSplitCombinedType
struct DataSplitCombined <: CFAR.MatrixData

Summary

A struct for combining training and validation data, containing only train and test splits.

Fields

source
CFAR.DataSplitCombinedMethod
DataSplitCombined(
    data::CFAR.LabeledDataset;
    p,
    normalize,
    scaling
) -> CFAR.DataSplitCombined

Summary

Returns a DataSplitCombined from a LabeledDataset with a provided split ratio p.

Arguments

Method List / Definition Locations

DataSplitCombined(data; p, normalize, scaling)

defined at /home/runner/work/CFAR/CFAR/src/lib/data.jl:295.

source
CFAR.ExperienceType
struct Experience

Summary

Experience block for an agent.

Taken from l2logger_template.

Fields

  • task_name::String: The task name.
  • block_type::String: The block type, valid values are ∈ ["train", "test"].
  • update_model::Bool: Flag for updating the model (i.e., true is to train, false is to classify).
source
CFAR.ExperienceMethod
Experience(
    task_name::AbstractString,
    seq_nums::CFAR.SequenceNums,
    block_type::AbstractString
) -> CFAR.Experience

Summary

Constructs an Experience, setting the update_model field based upon the block type.

Arguments

  • task_name::AbstractString: the name of the current task.
  • seq_nums::SequenceNums: the block and experience number of the Experience.
  • block_type::AbstractString: the block type ∈ ["train", "test"]. Using "train" sets update_model to true, "test" to false.

Method List / Definition Locations

Experience(task_name, seq_nums, block_type)

defined at /home/runner/work/CFAR/CFAR/src/lib/l2/experience.jl:76.

source
CFAR.ExperienceQueueContainerType
struct ExperienceQueueContainer

Summary

Container for the ExperienceQueue and some statistics about it.

Fields

  • stats::Dict{String, Any}: The statistics about the queue. NOTE These statistics reflect the queue at construction, not after any processing.
source
CFAR.FeaturesType

Features

Description

Definition of features as a matrix of floating-point numbers of dimension (featuredim, nsamples).

source
CFAR.LabelType

Label

Description

Alias declaring that a supervised label is a string.

source
CFAR.LabelsType

Labels

Description

Definition of labels as a vector of strings.

source
CFAR.MatrixDataType
abstract type MatrixData <: CFAR.TTDataset

Summary

Abstract type for data structs that represent features as matrices.

Fields

source
CFAR.MoverSplitType
struct MoverSplit

Summary

Definition of a split of data with one part remaining static and the other moving.

Fields

  • config::Dict{Any, Any}: The config used to generate the mover.
source
CFAR.MoverSplitMethod
MoverSplit(
    static::CFAR.LabeledDataset,
    mover::CFAR.LabeledDataset,
    config::Dict{Any, Any}
) -> CFAR.MoverSplit

Summary

Constructor for a MoverSplit taking a preconstructed static and mover LabeledDatasets along with a split parameter p.

Arguments

  • static::LabeledDataset: the static part of the dataset.
  • mover::LabeledDataset: the moving part of the datset.

Method List / Definition Locations

MoverSplit(static, mover, config)

defined at /home/runner/work/CFAR/CFAR/src/lib/data.jl:358.

source
CFAR.SampleType

Sample

Description

Alias declaring a sample as a vector of floating-point values.

source
CFAR.SamplesType

Samples

Description

Alias declaring that a sample batch is a vector of samples.

source
CFAR.SequenceNumsType
struct SequenceNums

Summary

Sequence numbers for a block and Experience.

Taken from l2logger_template.

Fields

  • block_num::Int64: The block number.
  • exp_num::Int64: The experience number.
  • task_num::Int64: The task-specific count.
source
CFAR.StatsDictType

StatsDict

Description

Alias for a statistics dictionary being string keys mapping to any object.

source
CFAR.TTDatasetType
abstract type TTDataset

Summary

Abstract supertype for all train/test dataset structs in this library.

Fields

source
CFAR.TargetType

Target

Description

Alias declaring that a supervised target is an integer.

source
CFAR.TargetsType

Targets

Description

Definition of targets as a vector of integers.

source
CFAR.VectoredDataType
abstract type VectoredData <: CFAR.TTDataset

Summary

Abstract type for data structs that represent features as vectors of matrices.

Fields

source
CFAR._save_plotMethod
_save_plot(p::Plots.Plot, filename::AbstractString) -> Any

Summary

Wrapper for how figures are saved in the CFAR project.

Arguments

  • p::Plots.Plot: the Plot object to save.
  • filename::AbstractString: the full file path as a string.

Method List / Definition Locations

_save_plot(p, filename)

defined at /home/runner/work/CFAR/CFAR/src/lib/plot.jl:330.

source
CFAR._save_tableMethod
_save_table(table, filename::AbstractString) -> Any

Summary

Wrapper for how tables are saved in the CFAR project.

Arguments

  • table: the table object to save.
  • filename::AbstractString: the full file path as a string.

Method List / Definition Locations

_save_table(table, filename)

defined at /home/runner/work/CFAR/CFAR/src/lib/plot.jl:341.

source
CFAR.conda_runMethod
conda_run(cmd_string::AbstractString) -> Any

Summary

Runs a provided command with the correct CondaPkg.jl Python environment.

Arguments

  • cmd_string::AbstractString: the Python command to run as a string, excluding the initial 'python' part.

Method List / Definition Locations

conda_run(cmd_string)

defined at /home/runner/work/CFAR/CFAR/src/lib/py.jl:43.

source
CFAR.dist_exp_parseFunction
dist_exp_parse() -> Any
dist_exp_parse(description::AbstractString) -> Any

Summary

Parses the command line for common options in distributed experiments.

Arguments

  • description::AbstractString: optional positional, the script description for the parser

Method List / Definition Locations

dist_exp_parse()
dist_exp_parse(description)

defined at /home/runner/work/CFAR/CFAR/src/lib/utils/args.jl:61.

source
CFAR.evaluate_agent!Method
evaluate_agent!(
    agent::CFAR.Agent,
    experience::CFAR.Experience,
    data::CFAR.VectoredData
) -> Dict

Summary

Evaluates a single agent on a single experience, training or testing as needed.

Arguments

  • agent::Agent: the Agent to evaluate.
  • exp::Experience: the Experience to use for training/testing.

Method List / Definition Locations

evaluate_agent!(agent, experience, data)

defined at /home/runner/work/CFAR/CFAR/src/lib/l2/agents.jl:152.

source
CFAR.exp_parseFunction
exp_parse() -> Any
exp_parse(description::AbstractString) -> Any

Summary

Parses the command line for common options in serial (non-distributed) experiments.

Arguments

  • description::AbstractString: optional positional, the script description for the parser

Method List / Definition Locations

exp_parse()
exp_parse(description)

defined at /home/runner/work/CFAR/CFAR/src/lib/utils/args.jl:35.

source
CFAR.feature_preprocessMethod
feature_preprocess(
    dt::StatsBase.ZScoreTransform,
    scaling::Real,
    data::AbstractMatrix{T} where T<:Real
) -> Any

Summary

Preprocesses one dataset of features, scaling and squashing along the feature axes.

Arguments

  • dt::ZScoreTransform: the Gaussian statistics of the features.
  • scaling::Real: the sigmoid scaling parameter.
  • data::RealMatrix: the 2-D matrix of features to transform.

Method List / Definition Locations

feature_preprocess(dt, scaling, data)

defined at /home/runner/work/CFAR/CFAR/src/lib/data.jl:499.

source
CFAR.gen_gaussiansMethod
gen_gaussians(
    config_file::AbstractString
) -> CFAR.MoverSplit

Summary

Generate the Gaussian dataset from the parameters specified in the provided file.

Arguments

  • config_file::AbstractString: the config file name as a string.

Method List / Definition Locations

gen_gaussians(config_file)

defined at /home/runner/work/CFAR/CFAR/src/lib/gaussians.jl:179.

source
CFAR.get_argparsesettingsFunction
get_argparsesettings() -> Any
get_argparsesettings(description::AbstractString) -> Any

Summary

Common function for how ArgParseSettings are generated in the project.

Arguments

  • description::AbstractString: optional positional, the script description for the parser

Method List / Definition Locations

get_argparsesettings()
get_argparsesettings(description)

defined at /home/runner/work/CFAR/CFAR/src/lib/utils/args.jl:19.

source
CFAR.get_distMethod
get_dist(
    data::AbstractMatrix{T} where T<:Real
) -> StatsBase.ZScoreTransform

Summary

Get the distribution parameters for preprocessing.

Arguments

  • data::RealMatrix: a 2-D matrix of features for computing the Gaussian statistics of.

Method List / Definition Locations

get_dist(data)

defined at /home/runner/work/CFAR/CFAR/src/lib/data.jl:487.

source
CFAR.get_distsMethod
get_dists(
    config::Dict{Any, Any}
) -> Vector{Distributions.MvNormal}

Summary

Gets the distribution generators based upon the config parameters.

Arguments

  • config::ConfigDict: the config parameters as a dictionary.

Method List / Definition Locations

get_dists(config)

defined at /home/runner/work/CFAR/CFAR/src/lib/gaussians.jl:76.

source
CFAR.get_index_from_nameMethod
get_index_from_name(
    labels::Array{T<:AbstractString, 1},
    name::AbstractString
) -> Any

Summary

Gets an integer index of where a string name appears in a list of strings.

Arguments

  • labels::Vector{T} where T <: AbstractString: the list of strings to search.
  • name::AbstractString: the name to search for in the list of labels.

Method List / Definition Locations

get_index_from_name(labels, name)

defined at /home/runner/work/CFAR/CFAR/src/lib/l2/agents.jl:134.

source
CFAR.get_manual_splitMethod
get_manual_split(
    data::AbstractMatrix{T} where T<:Real,
    targets::AbstractVector{T} where T<:Integer;
    p
) -> Tuple{Tuple{Any, Any}, Tuple{Any, Any}}

Summary

Teturns a manual train/test x/y split from a data matrix and labels using MLDataUtils.

Arguments

  • data::RealMatrix: the feature data to split into training and testing.
  • targets::IntegerVector: the labels corresponding to the data to split into training and testing.
  • p::Float=0.8: kwarg, the split ratio ∈ (0, 1).

Method List / Definition Locations

get_manual_split(data, targets; p)

defined at /home/runner/work/CFAR/CFAR/src/lib/data.jl:255.

source
CFAR.get_mover_lineMethod
get_mover_line(
    config::Dict{Any, Any};
    n_points,
    length
) -> Any

Summary

Generates a dataset of points representing the mover's direction of traversal.

Arguments

  • config::ConfigDict: the config parameters as a dictionary.

  • n_points::Integer=2: kwarg, number of points along the line to return.

  • length::Float=10.0: kwarg, length of the line.

Method List / Definition Locations

get_mover_line(config; n_points, length)

defined at /home/runner/work/CFAR/CFAR/src/lib/plot.jl:78.

source
CFAR.get_pylibMethod
get_pylib(lib::AbstractString) -> PythonCall.Core.Py

Summary

Loads and returns a handle to the provided local Python library.

Arguments

  • lib::AbstractString: the string name of the local Python library to load.

Method List / Definition Locations

get_pylib(lib)

defined at /home/runner/work/CFAR/CFAR/src/lib/py.jl:17.

source
CFAR.get_shiftMethod
get_shift(config::Dict{Any, Any}, s::Float64) -> Any

Summary

Gets the shift vector from the configuration and distance to traverse.

Arguments

  • config::ConfigDict: the config parameters as a dictionary.

  • s::Float: the distance to travel along the line

Method List / Definition Locations

get_shift(config, s)

defined at /home/runner/work/CFAR/CFAR/src/lib/gaussians.jl:211.

source
CFAR.get_table_rowMethod
get_table_row(
    data::CFAR.DataSplitCombined,
    label::AbstractString
) -> Vector{Any}

Summary

Constructs a DataFrame table row for saving to an Arrow table.

Arguments

  • data::DataSplitCombined: the data split.
  • label::AbstractString: the string label for the data split.

Method List / Definition Locations

get_table_row(data, label)

defined at /home/runner/work/CFAR/CFAR/src/lib/gaussians.jl:356.

source
CFAR.get_windowsMethod
get_windows(
    vs::AbstractVector{T} where T<:Real,
    n::Integer
) -> Any

Summary

Constructs a windowed matrix of a vector.

Arguments

  • vs::RealVector: the original vector.
  • n::Integer: the size of the sliding window.

Method List / Definition Locations

get_windows(vs, n)

defined at /home/runner/work/CFAR/CFAR/src/lib/plot.jl:260.

source
CFAR.initialize_exp_queue!Method
initialize_exp_queue!(
    eqc::CFAR.ExperienceQueueContainer,
    scenario_dict::AbstractDict
)

Summary

Initializes an ExperienceQueueContainer from the provided scenario dictionary.

Arguments

  • eqc::ExperienceQueueContainer: the container with the queue and stats to initialize.
  • scenario_dict::AbstractDict: the dictionary with the scenario regimes and block types.

Method List / Definition Locations

initialize_exp_queue!(eqc, scenario_dict)

defined at /home/runner/work/CFAR/CFAR/src/lib/l2/scenario.jl:56.

source
CFAR.json_saveMethod
json_save(filepath::AbstractString, dict::AbstractDict)

Summary

Saves the dictionary to a JSON file.

Arguments

  • filepath::AbstractString: the full file name (with path) to save to.
  • dict::AbstractDict: the dictionary to save to the file.

Method List / Definition Locations

json_save(filepath, dict)

defined at /home/runner/work/CFAR/CFAR/src/lib/l2/common.jl:83.

source
CFAR.load_datasetsFunction
load_datasets() -> Dict{String, CFAR.LabeledDataset}
load_datasets(
    topdir::AbstractString
) -> Dict{String, CFAR.LabeledDataset}

Summary

Loads all of the data sets from the local data package folder.

Arguments

  • topdir::AbstractString = data_dir("data-package"):

Method List / Definition Locations

load_datasets()
load_datasets(topdir)

defined at /home/runner/work/CFAR/CFAR/src/lib/data.jl:514.

source
CFAR.load_vec_datasetsFunction
load_vec_datasets() -> Dict{String, CFAR.DSIC}
load_vec_datasets(p::Float64) -> Dict{String, CFAR.DSIC}
load_vec_datasets(
    p::Float64,
    seed::Real
) -> Dict{String, CFAR.DSIC}

Summary

Method List / Definition Locations

load_vec_datasets()
load_vec_datasets(p)
load_vec_datasets(p, seed)

defined at /home/runner/work/CFAR/CFAR/src/lib/data.jl:628.

source
CFAR.log_dataMethod
log_data(
    data_logger::PythonCall.Core.Py,
    experience::CFAR.Experience,
    results::Dict,
    params::Dict;
    status
) -> PythonCall.Core.Py

Summary

Logs data from an L2 Experience.

Arguments

Method List / Definition Locations

log_data(data_logger, experience, results, params; status)

defined at /home/runner/work/CFAR/CFAR/src/lib/l2/agents.jl:190.

source
CFAR.plot_2d_attrsMethod
plot_2d_attrs(
    df::DataFrames.DataFrame,
    attrs::Array{T<:AbstractString, 1};
    avg,
    n,
    title
) -> Plots.Plot

Summary

Plots the 2D performances trends.

Arguments

  • df::DataFrame: the collected simulation results.
  • attrs::Vector{T} where T <: AbstractString: the columns in the dataframe as a list of strings to create plotlines for.
  • avg::Bool=false: optional, default false, flag to compute the windowed averages of the trends.
  • n::Integer=10: optional, default 10, the size of the average sliding window if that option is used.

Method List / Definition Locations

plot_2d_attrs(df, attrs; avg, n, title)

defined at /home/runner/work/CFAR/CFAR/src/lib/plot.jl:206.

source
CFAR.plot_2d_errlinesMethod
plot_2d_errlines(
    df::DataFrames.DataFrame,
    attrs::Array{T<:AbstractString, 1};
    n,
    title
) -> Plots.Plot

Summary

Plots the 2D performances trends.

Arguments

  • df::DataFrame: the collected simulation results.
  • attrs::Vector{T} where T <: AbstractString: the columns in the dataframe as a list of strings to create plotlines for.

Method List / Definition Locations

plot_2d_errlines(df, attrs; n, title)

defined at /home/runner/work/CFAR/CFAR/src/lib/plot.jl:283.

source
CFAR.plot_covellipsesMethod
plot_covellipses(p::Plots.Plot, config::Dict{Any, Any})

Summary

Plots the covariance ellipses from the config on top of an existing plot.

Arguments

  • p::Plots.Plot: an existing Plots.Plot object.

  • config::ConfigDict: the config parameters as a dictionary.

Method List / Definition Locations

plot_covellipses(p, config)

defined at /home/runner/work/CFAR/CFAR/src/lib/plot.jl:47.

source
CFAR.run_scenarioMethod
run_scenario(
    agent::CFAR.Agent,
    data::CFAR.VectoredData,
    data_logger::PythonCall.Core.Py
)

Summary

Runs an agent's scenario.

Arguments

  • agent::Agent: a struct that contains an Agent and scenario.
  • data_logger::PythonCall.Py: a l2logger object.

Method List / Definition Locations

run_scenario(agent, data, data_logger)

defined at /home/runner/work/CFAR/CFAR/src/lib/l2/agents.jl:214.

source
CFAR.sanitize_in_listMethod
sanitize_in_list(
    selection_type::AbstractString,
    selection,
    acceptable::Array{T, 1}
)

Summary

Sanitizes a selection within a list of acceptable options.

Arguments

  • selection_type::AbstractString: a string describing the option in case it is misused.
  • selection::Any: a single selection from a list.

Method List / Definition Locations

sanitize_in_list(selection_type, selection, acceptable)

defined at /home/runner/work/CFAR/CFAR/src/lib/l2/common.jl:45.

source
CFAR.save_plotMethod
save_plot(
    p::Plots.Plot,
    fig_name::AbstractString,
    exp_top::AbstractString,
    exp_name::AbstractString
)

Summary

Saves the plot to the both the local results directory and to the paper directory.

Arguments

  • p::Plots.Plot: the handle of the plot to save.
  • fig_name::AbstractString: the name of the figure file itself.
  • exp_top::AbstractString: the top of the experiment directory.
  • exp_name::AbstractString: the name of the experiment itself.

Method List / Definition Locations

save_plot(p, fig_name, exp_top, exp_name)

defined at /home/runner/work/CFAR/CFAR/src/lib/plot.jl:364.

source
CFAR.save_simMethod
save_sim(
    dir_func::Function,
    d::AbstractDict,
    fulld::AbstractDict
)

Summary

Common save function for simulations.

Arguments

  • dir_func::Function: the function that provides the correct file path with provided strings.

  • d::AbstractDict: the simulation options dictionary.

  • fulld::AbstractDict: the dictionary containing the sim results.

Method List / Definition Locations

save_sim(dir_func, d, fulld)

defined at /home/runner/work/CFAR/CFAR/src/lib/experiments.jl:64.

source
CFAR.scatter_gaussian!Method
scatter_gaussian!(
    p::Plots.Plot,
    data::CFAR.DataSplitCombined
)

Summary

Combines and plots data from a gaussian distribution.

Arguments

  • p::Plots.Plot: the plot handle to add the gaussians to.
  • data::DataSplitCombined: the data to plot.

Method List / Definition Locations

scatter_gaussian!(p, data)

defined at /home/runner/work/CFAR/CFAR/src/lib/plot.jl:18.

source
CFAR.shift_moverMethod
shift_mover(
    ms::CFAR.MoverSplit,
    s::Float64
) -> CFAR.MoverSplit

Summary

Moves the mover component of a MoverSplit a distance of s.

Arguments

  • ms::MoverSplit: the datset containing a mover to shift.

  • config::ConfigDict: the config parameters as a dictionary.

  • s::Float: the distance to travel along the line

Method List / Definition Locations

shift_mover(ms, s)

defined at /home/runner/work/CFAR/CFAR/src/lib/gaussians.jl:246.

source
CFAR.sliding_avgMethod
sliding_avg(
    vs::AbstractVector{T} where T<:Real,
    n::Integer
) -> Any

Summary

Computes the averages of a sliding window along a vector.

Arguments

  • vs::RealVector: the vector to compute windowed averages of.
  • n::Integer: the size of the sliding window.

Method List / Definition Locations

sliding_avg(vs, n)

defined at /home/runner/work/CFAR/CFAR/src/lib/plot.jl:187.

source
CFAR.train_test_mlp_mcMethod
train_test_mlp_mc(
    d::AbstractDict,
    ms::CFAR.MoverSplit,
    dir_func::Function,
    opts::AbstractDict
)

Summary

Train and test an MLP on the MoverSplit dataset.

Arguments

  • d::AbstractDict: the simulation options dictionary.

  • ms::MoverSplit: the MoverSplit dataset to train and test on.

  • dir_func::Function: the function that provides the correct file path with provided strings.

  • opts::AbstractDict: additional options for the simulation.

Method List / Definition Locations

train_test_mlp_mc(d, ms, dir_func, opts)

defined at /home/runner/work/CFAR/CFAR/src/lib/experiments.jl:202.

source
CFAR.train_test_sfam_mcMethod
train_test_sfam_mc(
    d::AbstractDict,
    ms::CFAR.MoverSplit,
    dir_func::Function,
    opts::AbstractDict
)

Summary

Train and test SFAM on the MoverSplit dataset in parallel.

Arguments

  • d::AbstractDict: the simulation options dictionary.

  • ms::MoverSplit: the MoverSplit dataset to train and test on.

  • dir_func::Function: the function that provides the correct file path with provided strings.

  • opts::AbstractDict: additional options for the simulation.

Method List / Definition Locations

train_test_sfam_mc(d, ms, dir_func, opts)

defined at /home/runner/work/CFAR/CFAR/src/lib/experiments.jl:91.

source