Data, Iteration, and Logging Utilities

Internal helpers for preprocessing, iteration, storage, and documentation.

Index

Data Preparation

init_train!

AdaptiveResonance.init_train! — Function
init_train!(
    x::AbstractVector{T} where T<:Real,
    art::ARTModule,
    preprocessed::Bool
) -> AbstractVector{T} where T<:Real

Summary

Initializes the module for training in a single iteration.

The purpose of this function is mainly to handle the conditions of complement coding. Fails if the module was incorrectly set up or if the module was not setup and the data was not preprocessed.

Arguments

  • x::RealVector: the sample used for initialization.
  • art::ARTModule: the ART/ARTMAP module that will be trained on the sample.
  • preprocessed::Bool: a required flag for if the sample has already been complement coded and normalized.

Method List / Definition Locations

init_train!(x, art, preprocessed)

defined at /home/runner/work/AdaptiveResonance.jl/AdaptiveResonance.jl/src/ART/single/modules/HypersphereART.jl:144.

init_train!(x, art, preprocessed)

defined at /home/runner/work/AdaptiveResonance.jl/AdaptiveResonance.jl/src/lib/common.jl:470.

source
init_train!(
    x::AbstractMatrix{T} where T<:Real,
    art::ARTModule,
    preprocessed::Bool
) -> Any

Summary

Initializes the training loop for batch learning.

Arguments

  • x::RealMatrix: the data that is used for training.
  • art::ARTModule: the ART/ARTMAP that will be trained.
  • preprocessed::Bool: required flag for if the data has already been complement coded and normalized.

Method List / Definition Locations

init_train!(x, art, preprocessed)

defined at /home/runner/work/AdaptiveResonance.jl/AdaptiveResonance.jl/src/ART/single/modules/HypersphereART.jl:155.

init_train!(x, art, preprocessed)

defined at /home/runner/work/AdaptiveResonance.jl/AdaptiveResonance.jl/src/lib/common.jl:501.

source

init_classify!

AdaptiveResonance.init_classify! — Function
init_classify!(
    x::AbstractArray{T} where T<:Real,
    art::ARTModule,
    preprocessed::Bool
) -> Any

Summary

Initializes the classification loop for batch inference.

Arguments

  • x::RealArray: the data that is used for inference.
  • art::ARTModule: the ART/ARTMAP module that will be used for inference.
  • preprocessed::Bool: required flag for if the data has already been complement coded and normalized.

Method List / Definition Locations

init_classify!(x, art, preprocessed)

defined at /home/runner/work/AdaptiveResonance.jl/AdaptiveResonance.jl/src/ART/single/modules/HypersphereART.jl:170.

init_classify!(x, art, preprocessed)

defined at /home/runner/work/AdaptiveResonance.jl/AdaptiveResonance.jl/src/lib/common.jl:519.

source

hypersphere_preprocess

get_dim

get_n_samples

get_data_shape

get_sample

AdaptiveResonance.get_sample — Function
get_sample(
    x::AbstractMatrix{T} where T<:Real,
    i::Integer
) -> Any

Summary

Returns a sample from data array x at sample location i. This function implements the convention that columns are samples while rows are features within samples.

Arguments

  • x::RealMatrix: the batch of data to grab a sample from.
  • i::Integer: the index to get the sample from.

Method List / Definition Locations

get_sample(x, i)

defined at /home/runner/work/AdaptiveResonance.jl/AdaptiveResonance.jl/src/lib/common.jl:453.

source

element_min

Iteration and Logging

get_iterator

AdaptiveResonance.get_iterator — Function
get_iterator(opts::ARTOpts, n_samples::Integer) -> Any

Summary

Creates an iterator object according to the ART/ARTMAP modules display settings for batch iteration.

Arguments

  • opts::ARTOpts: the ART/ARTMAP module's options containing display settings.
  • n_samples::Integer: the number of iterations to create the iterator for.

Method List / Definition Locations

get_iterator(opts, n_samples)

defined at /home/runner/work/AdaptiveResonance.jl/AdaptiveResonance.jl/src/lib/common.jl:417.

source

update_iter

AdaptiveResonance.update_iter — Function
update_iter(
    art::ARTModule,
    iter::Union{ProgressBars.ProgressBar, UnitRange},
    i::Integer
) -> Union{Nothing, String}

Summary

Updates the iteration of the ART/ARTMAP module, training or inference, according to its display settings.

Arguments

  • art::ARTModule: the ART/ARTMAP module being iterated upon.
  • iter::ARTIterator: the iterator object used in the training/inference loop.
  • i::Integer: the iteration during training/inference that the iterator should be updated to.

Method List / Definition Locations

update_iter(art, iter, i)

defined at /home/runner/work/AdaptiveResonance.jl/AdaptiveResonance.jl/src/lib/common.jl:436.

source

build_art_stats

log_art_stats!

AdaptiveResonance.log_art_stats! — Function
log_art_stats!(art::ARTModule, bmu::Integer, mismatch::Bool)

Summary

Logs common statistics of an ART module after a training/classification iteration.

Arguments

  • art::ARTModule: the ART module that just underwent training/classification.
  • bmu::Integer: the best-matching unit integer index.
  • mismatch::Bool: flag of whether there was a mismatch in this iteration.

Method List / Definition Locations

log_art_stats!(art, bmu, mismatch)

defined at /home/runner/work/AdaptiveResonance.jl/AdaptiveResonance.jl/src/lib/common.jl:160.

source

Storage Operations

replace_mat_index!

AdaptiveResonance.replace_mat_index! — Function
replace_mat_index!(
    mat::AbstractMatrix{T} where T<:Real,
    vec::AbstractVector{T} where T<:Real,
    index::Integer
) -> AbstractVector{T} where T<:Real

Summary

Replaces a matrix element with a vector at the column index.

This function dispatches to the low-level replacement strategy.

Arguments

  • mat::RealMatrix: the matrix to update with a replaced column vector.
  • vec::RealVector: the vector to put in the matrix at the column index.
  • index::Integer: the column index to put the vector.

Method List / Definition Locations

replace_mat_index!(mat, vec, index)

defined at /home/runner/work/AdaptiveResonance.jl/AdaptiveResonance.jl/src/lib/subroutines.jl:19.

source

unsafe_replace_mat_index!

AdaptiveResonance.unsafe_replace_mat_index! — Function
unsafe_replace_mat_index!(
    mat::AbstractMatrix{T} where T<:Real,
    vec::AbstractVector{T} where T<:Real,
    index::Integer
) -> AbstractVector{T} where T<:Real

Summary

Low-level function for unsafely replacing a matrix column with a given vector.

Arguments

  • mat::RealMatrix: the matrix to update with a replaced column vector.
  • vec::RealVector: the vector to put in the matrix at the column index.
  • index::Integer: the column index to put the vector.

Method List / Definition Locations

unsafe_replace_mat_index!(mat, vec, index)

defined at /home/runner/work/AdaptiveResonance.jl/AdaptiveResonance.jl/src/lib/subroutines.jl:28.

source

accommodate_vector!

Docstring Templates

_COMMON_DOC

_OPTS_DOCSTRING

_ARG_ART

_ARG_X

_ARG_W

_ARG_INDEX

_ARG_ART_X_W

_ARGS_MATRIX_REPLACE

MATCH_FUNCTIONS_DOCS

ACTIVATION_FUNCTIONS_DOCS