API Reference

Data and features

NiaARM.DatasetType
Dataset(df_or_path)

Wrap a tabular dataset and derive feature metadata used by optimizers. Accepts either a DataFrame or path to a CSV file. Features are inferred from column types and overall problem dimensionality is computed for use with optimization algorithms.

source
NiaARM.NumericalFeatureType
NumericalFeature(name, min, max)

Metadata describing a numerical column along with its observed minimum and maximum. Bounds are used to scale optimizer solutions back into meaningful ranges.

source
NiaARM.dtypeFunction
dtype(attribute)

Return the underlying numeric element type carried by an attribute or feature. For categorical elements, String is returned.

source
NiaARM.isnumericalFunction
isnumerical(feature)

Return true when a feature is numerical.

source
isnumerical(attribute)

Return true when an attribute is numerical.

source
NiaARM.iscategoricalFunction
iscategorical(feature)

Return true when a feature is categorical.

source
iscategorical(attribute)

Return true when an attribute is categorical.

source

Attributes and rules

NiaARM.NumericalAttributeType
NumericalAttribute(name, min, max)

Closed interval constraint on a numerical feature used in rule antecedents or consequents. min must be less than or equal to max; the numeric element type is inferred from the provided bounds.

source
NiaARM.CategoricalAttributeType
CategoricalAttribute(name, category)

Equality constraint on a categorical feature. Rules will match rows where the column name equals category.

source
NiaARM.ContingencyTableType
ContingencyTable(antecedent, consequent, transactions)

Sufficient statistics for evaluating a candidate rule against a dataset. Counts cover the four quadrants of a 2x2 contingency table and store amplitude/inclusion metadata computed during rule construction.

source
NiaARM.RuleType
Rule(antecedent, consequent[, fitness, ct])

Represents a mined association rule with its antecedent and consequent attribute constraints, the current fitness value, and a cached ContingencyTable.

source
NiaARM.countallFunction
countall(ct::ContingencyTable)
countall(rule::Rule)

Number of transactions satisfying both antecedent and consequent.

source
NiaARM.countlhsFunction
countlhs(ct::ContingencyTable)
countlhs(rule::Rule)

Number of transactions satisfying the antecedent only.

source
NiaARM.countrhsFunction
countrhs(ct::ContingencyTable)
countrhs(rule::Rule)

Number of transactions satisfying the consequent only.

source
NiaARM.countnullFunction
countnull(ct::ContingencyTable)
countnull(rule::Rule)

Number of transactions satisfying neither antecedent nor consequent.

source

Metrics

NiaARM.supportFunction
support(ct::ContingencyTable)
support(rule::Rule)

Fraction of transactions that satisfy both antecedent and consequent. Returns 0.0 if undefined.

source
NiaARM.confidenceFunction
confidence(ct::ContingencyTable)
confidence(rule::Rule)

Conditional probability of the consequent given the antecedent. Returns 0.0 if undefined.

source
NiaARM.coverageFunction
coverage(ct::ContingencyTable)
coverage(rule::Rule)

Support of the antecedent.

source
NiaARM.rhs_supportFunction
rhs_support(ct::ContingencyTable)
rhs_support(rule::Rule)

Support of the consequent alone.

source
NiaARM.liftFunction
lift(ct::ContingencyTable)
lift(rule::Rule)

Ratio between joint support and the product of antecedent and consequent supports.

source
NiaARM.convictionFunction
conviction(ct::ContingencyTable)
conviction(rule::Rule)

Measure of implication strength that penalizes counterexamples to the rule.

source
NiaARM.interestingnessFunction
interestingness(ct::ContingencyTable)
interestingness(rule::Rule)

Heuristic metric combining confidence, normalized support, and consequent prior.

source
NiaARM.yulesqFunction
yulesq(ct::ContingencyTable)
yulesq(rule::Rule)

Yule's Q association measure derived from the contingency table odds ratio.

source
NiaARM.netconfFunction
netconf(ct::ContingencyTable)
netconf(rule::Rule)

Net confidence metric capturing deviation from independence normalized by antecedent coverage.

source
NiaARM.zhangFunction
zhang(ct::ContingencyTable)
zhang(rule::Rule)

Zhang's metric providing a bounded, symmetric interestingness score.

source
NiaARM.leverageFunction
leverage(ct::ContingencyTable)
leverage(rule::Rule)

Absolute difference between observed and expected joint support under independence.

source
NiaARM.amplitudeFunction
amplitude(ct::ContingencyTable)
amplitude(rule::Rule)

Normalized width of the numerical intervals selected in a rule.

source
NiaARM.inclusionFunction
inclusion(ct::ContingencyTable)
inclusion(rule::Rule)

Portion of the dataset's feature space occupied by attributes present in the rule.

source
NiaARM.comprehensibilityFunction
comprehensibility(rule)

Log-scaled measure preferring rules with smaller antecedents relative to consequents.

source

Mining pipeline

NiaARM.mineFunction
mine(dataset, algorithm, criterion; metrics, kwargs...)

Run numerical association rule mining on a dataset using the provided optimization algorithm and StoppingCriterion. Returns a list of discovered Rules sorted by fitness. metrics may be a Dict of weights or a list of metric names.

source
NiaARM.narmFunction
narm(solution; problem, features, transactions, rules, metrics)

Objective function used by optimization algorithms. Decodes solution into a rule, evaluates it on transactions with the provided metrics, and inserts novel rules into rules. Returns the negated fitness so minimizers can be used for maximization.

source

Optimization setup

NiaARM.ProblemType
Problem(dimension, lowerbound, upperbound[, lowerinit, upperinit])

Continuous search-space description used by optimization algorithms. Bounds constrain candidate solutions and initialization ranges; validation guards against invalid domains.

source
NiaARM.StoppingCriterionType
StoppingCriterion(; maxevals=typemax(Int), maxiters=typemax(Int), acceptable_fitness=-Inf)

Stop condition shared by all optimizers. At least one limit must be finite so that the search terminates.

source
NiaARM.terminateFunction
terminate(criterion, evals, iters, bestfitness)

Return true when any stopping condition is met.

source

Algorithms

NiaARM.randomsearchFunction
randomsearch(feval, problem, criterion; seed=nothing, kwargs...)

Baseline optimizer that samples solutions uniformly within the problem bounds until the StoppingCriterion is met. Useful as a reference or for quick smoke tests.

source
NiaARM.psoFunction
pso(feval, problem, criterion; popsize=10, omega=0.7, c1=2.0, c2=2.0, seed=nothing, kwargs...)

Particle Swarm Optimization with inertia weight. Maintains a swarm of candidate rules, updating velocities toward personal and global best positions while respecting problem bounds.

source
NiaARM.deFunction
de(feval, problem, criterion; popsize=50, cr=0.8, f=0.9, seed=nothing, kwargs...)

Differential Evolution using DE/rand/1/bin strategy. Generates trial vectors via differential mutation and binomial crossover, selecting improvements greedily.

source
NiaARM.baFunction
ba(feval, problem, criterion; popsize=40, loudness0=1.0, pulse_rate0=1.0, fmin=0.0, fmax=2.0, alpha=0.97, gamma=0.1, seed=nothing, kwargs...)

Bat Algorithm implementation following frequency-tuned velocity updates and adaptive loudness/pulse rate schedules. Exploits the current global best while injecting random walks for local search.

source
NiaARM.saFunction
sa(feval, problem, criterion; initial_temp=100.0, min_temp=1e-12, cooling_rate=0.95, step_size=0.1, seed=nothing, kwargs...)

Simulated Annealing with Gaussian perturbations. Accepts worse solutions according to the current temperature to escape local minima and cools multiplicatively.

source
NiaARM.gaFunction
ga(feval, problem, criterion; popsize=50, tournament_size=5, crossover_rate=0.7, mutation_rate=0.05, seed=nothing, kwargs...)

Steady-state Genetic Algorithm with tournament selection, uniform crossover, and per-gene mutation. Populations are clamped to the Problem bounds each generation.

source
NiaARM.lshadeFunction
lshade(feval, problem, criterion; popsize=18, memorysize=6, pbestrate=0.11, archiverate=2.6, seed=nothing, kwargs...)

L-SHADE with current-to-pbest/1/bin mutation, success-history based parameter adaptation, an external archive, and linear population size reduction. Requires StoppingCriterion.maxevals to be set for the reduction schedule.

source
NiaARM.esFunction
es(feval, problem, criterion; mu=15, lambda=100, sigmainit=0.3, tau=nothing, tauprime=nothing, seed=nothing, kwargs...)

Self-adaptive (μ, λ) Evolution Strategy with log-normal step-size control. Generates offspring via Gaussian perturbations and selects the best mu individuals each generation.

source
NiaARM.abcFunction
abc(feval, problem, criterion; popsize=20, limit=100, seed=nothing, kwargs...)

Artificial Bee Colony optimizer splitting workers and onlookers across a set of food sources. Exploits neighbor differences to propose new points and periodically replaces stagnant sources with scouts.

source
NiaARM.csFunction
cs(feval, problem, criterion; popsize=25, pa=0.25, seed=nothing, kwargs...)

Cuckoo Search using Lévy flights and discovery probability pa for nest replacement. Maintains best nest while generating new solutions via random permutations and heavy- tailed steps.

source
NiaARM.faFunction
fa(feval, problem, criterion; popsize=20, alpha=1.0, beta0=1.0, gamma=0.01, theta=0.97, seed=nothing, kwargs...)

Firefly Algorithm where attraction decreases exponentially with distance. Random walk amplitude decays by theta each iteration to balance exploration and exploitation.

source
NiaARM.fpaFunction
fpa(feval, problem, criterion; popsize=25, p=0.8, seed=nothing, kwargs...)

Flower Pollination Algorithm alternating global Lévy flights and local pollination steps with switch probability p. Tracks the current best solution across the population.

source

Utilities

NiaARM.randlevyFunction
randlevy(rng; alpha=0.01, beta=1.5)

Draw a Lévy-distributed random variate using the Mantegna algorithm.

source
NiaARM.initpopulationFunction
initpopulation(popsize, problem, rng)

Sample an initial population uniformly within the problem initialization bounds.

source