Data, Iteration, and Logging Utilities
Internal helpers for preprocessing, iteration, storage, and documentation.
Index
init_train!,init_classify!,hypersphere_preprocess,get_dim,get_n_samples,get_data_shape,get_sample,element_minget_iterator,update_iter,build_art_stats,log_art_stats!replace_mat_index!,unsafe_replace_mat_index!,accommodate_vector!_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
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.
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.
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.
hypersphere_preprocess
AdaptiveResonance.hypersphere_preprocess — Function
hypersphere_preprocess(
x::AbstractArray{T} where T<:Real,
art::HypersphereART,
preprocessed::Bool
) -> Any
Summary
Validate Hypersphere ART input dimensions and normalize original features.
Method List / Definition Locations
hypersphere_preprocess(x, art, preprocessed)defined at /home/runner/work/AdaptiveResonance.jl/AdaptiveResonance.jl/src/ART/single/modules/HypersphereART.jl:178.
get_dim
AdaptiveResonance.get_dim — Function
get_dim(data::AbstractMatrix{T} where T<:Real) -> Any
Summary
Returns the dimension of the data, enforcint the (dim, n_samples) convention of the package.
Arguments
data::RealMatrix: the 2-D data to infer the feature dimension of.
Method List / Definition Locations
get_dim(data)defined at /home/runner/work/AdaptiveResonance.jl/AdaptiveResonance.jl/src/lib/common.jl:227.
get_n_samples
AdaptiveResonance.get_n_samples — Function
get_n_samples(data::AbstractMatrix{T} where T<:Real) -> Any
Summary
Returns the number of samples, enforcing the convention of the package.
Arguments
data::RealMatrix: the 2-D data to infer the number of samples from.
Method List / Definition Locations
get_n_samples(data)defined at /home/runner/work/AdaptiveResonance.jl/AdaptiveResonance.jl/src/lib/common.jl:238.
get_data_shape
AdaptiveResonance.get_data_shape — Function
get_data_shape(
data::AbstractMatrix{T} where T<:Real
) -> Tuple{Any, Any}
Summary
Returns the (dim, n_samples) of the provided 2-D data matrix, enforcing the ART package convention.
Arguments
data::RealMatrix: the 2-D data to infer the feature dimension and number of samples from.
Method List / Definition Locations
get_data_shape(data)defined at /home/runner/work/AdaptiveResonance.jl/AdaptiveResonance.jl/src/lib/common.jl:249.
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.
element_min
AdaptiveResonance.element_min — Function
element_min(
x::AbstractVector{T} where T<:Real,
W::AbstractVector{T} where T<:Real
) -> Any
Summary
Returns the element-wise minimum between sample x and weight W.
Arguments
x::RealVector: the input sample.W::RealVector: the weight vector to compare the sample against.
Method List / Definition Locations
element_min(x, W)defined at /home/runner/work/AdaptiveResonance.jl/AdaptiveResonance.jl/src/lib/common.jl:178.
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.
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.
build_art_stats
AdaptiveResonance.build_art_stats — Function
build_art_stats() -> Dict{String, Any}
Summary
Initializes an ARTStats dictionary with zero entries.
Method List / Definition Locations
build_art_stats()defined at /home/runner/work/AdaptiveResonance.jl/AdaptiveResonance.jl/src/lib/common.jl:138.
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.
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.
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.
accommodate_vector!
AdaptiveResonance.accommodate_vector! — Function
accommodate_vector!(vec::Array{T, 1}, goal_len::Integer)
Summary
Extends a vector to a goal length with zeros of its element type to accommodate in-place updates.
Arguments
vec::Vector{T}: a vector of arbitrary element type.goal_len::Integer: the length that the vector should be.
Method List / Definition Locations
accommodate_vector!(vec, goal_len)defined at /home/runner/work/AdaptiveResonance.jl/AdaptiveResonance.jl/src/lib/subroutines.jl:39.
Docstring Templates
_COMMON_DOC
AdaptiveResonance._COMMON_DOC — Constant
COMMONDOC
Description
Docstring prefix denoting that the constant is used as a common docstring element for other docstrings.
_OPTS_DOCSTRING
AdaptiveResonance._OPTS_DOCSTRING — Constant
OPTSDOCSTRING
Description
Common docstring: shared options docstring, inserted at the end of opts_<...> structs.
_ARG_ART
AdaptiveResonance._ARG_ART — Constant
ARGART
Description
Common docstring: shared argument docstring for ART module arguments.
_ARG_X
AdaptiveResonance._ARG_X — Constant
ARGX
Description
Common docstring: shared argument docstring for the input sample of features.
_ARG_W
AdaptiveResonance._ARG_W — Constant
ARGW
Description
Common docstring: shared argument docstring for the weight vector.
_ARG_INDEX
AdaptiveResonance._ARG_INDEX — Constant
ARGINDEX
Description
Common docstring: shared argument docstring for the index of the weight column.
_ARG_ART_X_W
AdaptiveResonance._ARG_ART_X_W — Constant
ARGARTXW
Description
Common docstring: shared arguments string for methods using an ART module, sample 'x', and weight vector 'W'.
_ARGS_MATRIX_REPLACE
AdaptiveResonance._ARGS_MATRIX_REPLACE — Constant
ARGSMATRIX_REPLACE
Description
Common docstring: shared arguments string for functions updating a column in a matrix.
MATCH_FUNCTIONS_DOCS
AdaptiveResonance.MATCH_FUNCTIONS_DOCS — Constant
MATCHFUNCTIONSDOCS
Description
Common docstring for listing available match functions.
ACTIVATION_FUNCTIONS_DOCS
AdaptiveResonance.ACTIVATION_FUNCTIONS_DOCS — Constant
ACTIVATIONFUNCTIONSDOCS
Description
Common docstring for listing available activation functions.