Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

132 fix variant statement warning #133

Merged
merged 5 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions refactor/.gitignore

This file was deleted.

14 changes: 0 additions & 14 deletions refactor/lib.jl

This file was deleted.

10 changes: 0 additions & 10 deletions refactor/profile.jl

This file was deleted.

12 changes: 0 additions & 12 deletions refactor/time.jl

This file was deleted.

2 changes: 1 addition & 1 deletion src/ART/distributed/modules/DDVFA.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Includes all of the structures and logic for running a Distributed Dual-Vigilanc
"""
Distributed Dual Vigilance Fuzzy ART options struct.

$(OPTS_DOCSTRING)
$(_OPTS_DOCSTRING)
"""
@with_kw mutable struct opts_DDVFA <: ARTOpts @deftype Float
"""
Expand Down
2 changes: 1 addition & 1 deletion src/ART/distributed/modules/MergeART.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Includes all of the structures and logic for running a MergeART module.
"""
MergeART options struct.

$(OPTS_DOCSTRING)
$(_OPTS_DOCSTRING)
"""
@with_kw mutable struct opts_MergeART <: ARTOpts @deftype Float
"""
Expand Down
2 changes: 1 addition & 1 deletion src/ART/single/modules/DVFA.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Includes all of the structures and logic for running a Dual-Vigilance Fuzzy ART
"""
Dual Vigilance Fuzzy ART options struct.

$(OPTS_DOCSTRING)
$(_OPTS_DOCSTRING)
"""
@with_kw mutable struct opts_DVFA <: ARTOpts @deftype Float
"""
Expand Down
2 changes: 1 addition & 1 deletion src/ART/single/modules/FuzzyART.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Includes all of the structures and logic for running a Gamma-Normalized Fuzzy AR
"""
Gamma-Normalized Fuzzy ART options struct.

$(OPTS_DOCSTRING)
$(_OPTS_DOCSTRING)
"""
@with_kw mutable struct opts_FuzzyART <: ARTOpts @deftype Float
"""
Expand Down
10 changes: 5 additions & 5 deletions src/ART/variants.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ Includes convenience constructors for common variants of various ART modules.
# -----------------------------------------------------------------------------

# Shared variant statement for GNFA
variant_statement = """
const _VARIANT_STATEMENT_GammaNormalizedFuzzyART = """
GammaNormalizedFuzzyART is a variant of [`FuzzyART`](@ref), using the [`AdaptiveResonance.opts_FuzzyART`](@ref) options.
This constructor passes `gamma_normalization=true`, which internally uses `match=:gamma_match` and `activation=:gamma_activation` in addition to the keyword argument options you provide.
"""

"""
Constructs a Gamma-Normalized FuzzyART module as a variant of FuzzyART by using the gamma_normalization option.

$(variant_statement)
$(_VARIANT_STATEMENT_GammaNormalizedFuzzyART)

# Arguments
- `kwargs`: keyword arguments of FuzzyART options (see [`AdaptiveResonance.opts_FuzzyART`](@ref))
Expand All @@ -31,7 +31,7 @@ end
"""
Implements a Gamma-Normalized FuzzyART module with specified options.

$(variant_statement)
$(_VARIANT_STATEMENT_GammaNormalizedFuzzyART)

# Arguments
- `opts::opts_FuzzyART`: the Fuzzy ART options (see [`AdaptiveResonance.opts_FuzzyART`](@ref)).
Expand All @@ -43,9 +43,9 @@ end
"""
Implements a Gamma-Normalized FuzzyART module's options.

$(variant_statement)
$(_VARIANT_STATEMENT_GammaNormalizedFuzzyART)

$(OPTS_DOCSTRING)
$(_OPTS_DOCSTRING)
"""
function opts_GammaNormalizedFuzzyART(;kwargs...)
return opts_FuzzyART(;choice_by_difference=true, kwargs...)
Expand Down
2 changes: 1 addition & 1 deletion src/ARTMAP/FAM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Options, structures, and logic for the Fuzzy ARTMAP (FAM) module.
"""
Implements a Fuzzy ARTMAP learner's options.

$(OPTS_DOCSTRING)
$(_OPTS_DOCSTRING)
"""
@with_kw mutable struct opts_FAM <: ARTOpts @deftype Float
"""
Expand Down
2 changes: 1 addition & 1 deletion src/ARTMAP/SFAM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Options, structures, and logic for the Simplified Fuzzy ARTMAP (SFAM) module.
"""
Implements a Simple Fuzzy ARTMAP learner's options.

$(OPTS_DOCSTRING)
$(_OPTS_DOCSTRING)
"""
@with_kw mutable struct opts_SFAM <: ARTOpts @deftype Float
"""
Expand Down
10 changes: 5 additions & 5 deletions src/ARTMAP/variants.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ Includes convenience constructors for common variants of various ARTMAP modules.
# -----------------------------------------------------------------------------

# Shared variant statement for Default ARTMAP
const variant_statement = """
const _VARIANT_STATEMENT_DAM = """
Default ARTMAP is a variant of SFAM, using the [`AdaptiveResonance.opts_SFAM`](@ref) options.
This constructor sets the activation to `:choice_by_difference` in addition to the keyword argument options you provide.
"""

"""
Constructs a Default ARTMAP module using a SFAM module using Default ARTMAP's choice-by-difference activation function.

$(variant_statement)
$(_VARIANT_STATEMENT_DAM)

# Arguments
- `kwargs`: keyword arguments of Simplified FuzzyARTMAP options (see [`AdaptiveResonance.opts_SFAM`](@ref))
Expand All @@ -33,7 +33,7 @@ end
"""
Implements a Default ARTMAP module with specified options.

$(variant_statement)
$(_VARIANT_STATEMENT_DAM)

# Arguments
- `opts::opts_SFAM`: the Simplified FuzzyARTMAP options (see [`AdaptiveResonance.opts_SFAM`](@ref)).
Expand All @@ -45,9 +45,9 @@ end
"""
Implements a Default ARTMAP module's options.

$(variant_statement)
$(_VARIANT_STATEMENT_DAM)

$(OPTS_DOCSTRING)
$(_OPTS_DOCSTRING)
"""
function opts_DAM(;kwargs...)
return opts_SFAM(;activation=:choice_by_difference, kwargs...)
Expand Down
54 changes: 32 additions & 22 deletions src/lib/docstrings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,53 +46,63 @@ $(METHODLIST)
# COMMON DOCUMENTATION CONSTANTS
# -----------------------------------------------------------------------------

# Shared options docstring, inserted at the end of `opts_<...>` structs.
const OPTS_DOCSTRING = """
"""
Docstring prefix denoting that the constant is used as a common docstring element for other docstrings.
"""
const _COMMON_DOC = "Common docstring:"

"""
$(_COMMON_DOC) shared options docstring, inserted at the end of `opts_<...>` structs.
"""
const _OPTS_DOCSTRING = """
These options are a [`Parameters.jl`](https://github.com/mauro3/Parameters.jl) struct, taking custom options keyword arguments.
Each field has a default value listed below.
"""

const ART_ARG_DOCSTRING = """
"""
$(_COMMON_DOC) shared argument docstring for ART module arguments.
"""
const _ARG_ART = """
- `art::ARTModule`: the ARTModule module.
"""

const X_ARG_DOCSTRING = """
"""
$(_COMMON_DOC) shared argument docstring for the input sample of features.
"""
const _ARG_X = """
- `x::RealVector`: the sample vector to use.
"""

const W_ARG_DOCSTING = """
"""
$(_COMMON_DOC) shared argument docstring for the weight vector.
"""
const _ARG_W = """
- `W::RealVector`: the weight vector to use.
"""

const INDEX_ARG_DOCSTRING = """
"""
$(_COMMON_DOC) shared argument docstring for the index of the weight column.
"""
const _ARG_INDEX = """
- `index::Integer`: the index of the weight column to use.
"""

"""
Shared arguments string for methods using an ART module, sample 'x', and weight vector 'W'.
$(_COMMON_DOC) shared arguments string for methods using an ART module, sample 'x', and weight vector 'W'.
"""
const ART_X_W_ARGS = """
const _ARG_ART_X_W = """
# Arguments
$(ART_ARG_DOCSTRING)
$(X_ARG_DOCSTRING)
$(W_ARG_DOCSTING)
$(_ARG_ART)
$(_ARG_X)
$(_ARG_W)
"""

"""
Shared arguments string for functions updating a column in a matrix.
$(_COMMON_DOC) shared arguments string for functions updating a column in a matrix.
"""
const MATRIX_REPLACE_ARGS_DOCSTRING = """
const _ARGS_MATRIX_REPLACE = """
# 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.
"""


# const ART_X_W_ARGS = """
# # Arguments
# - `art::ARTModule`: the ARTModule module.
# - `x::RealVector`: the sample to use.
# - `W::ARTMatrix`: the weight matrix to use.
# - `index::Integer`: the index of the weight to use.
# """
4 changes: 2 additions & 2 deletions src/lib/subroutines.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Replaces a matrix element with a vector at the column index.

This function dispatches to the low-level replacement strategy.

$MATRIX_REPLACE_ARGS_DOCSTRING
$_ARGS_MATRIX_REPLACE
"""
function replace_mat_index!(mat::RealMatrix, vec::RealVector, index::Integer)
unsafe_replace_mat_index!(mat, vec, index)
Expand All @@ -23,7 +23,7 @@ end
"""
Low-level function for unsafely replacing a matrix column with a given vector.

$MATRIX_REPLACE_ARGS_DOCSTRING
$_ARGS_MATRIX_REPLACE
"""
function unsafe_replace_mat_index!(mat::RealMatrix, vec::RealVector, index::Integer)
@inbounds mat[:, index] = vec
Expand Down