API Reference
Data and features
NiaARM.Dataset — Type
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.
NiaARM.AbstractFeature — Type
AbstractFeatureAbstract supertype describing dataset columns used to build candidate rules.
NiaARM.NumericalFeature — Type
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.
NiaARM.CategoricalFeature — Type
CategoricalFeature(name, categories)Metadata describing a categorical column and its possible category values.
NiaARM.dtype — Function
dtype(attribute)Return the underlying numeric element type carried by an attribute or feature. For categorical elements, String is returned.
NiaARM.isnumerical — Function
isnumerical(feature)Return true when a feature is numerical.
isnumerical(attribute)Return true when an attribute is numerical.
NiaARM.iscategorical — Function
iscategorical(feature)Return true when a feature is categorical.
iscategorical(attribute)Return true when an attribute is categorical.
Attributes and rules
NiaARM.AbstractAttribute — Type
AbstractAttributeAbstract supertype for all attribute descriptors that can appear in a mined rule.
NiaARM.NumericalAttribute — Type
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.
NiaARM.CategoricalAttribute — Type
CategoricalAttribute(name, category)Equality constraint on a categorical feature. Rules will match rows where the column name equals category.
NiaARM.ContingencyTable — Type
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.
NiaARM.Rule — Type
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.
NiaARM.countall — Function
countall(ct::ContingencyTable)
countall(rule::Rule)Number of transactions satisfying both antecedent and consequent.
NiaARM.countlhs — Function
countlhs(ct::ContingencyTable)
countlhs(rule::Rule)Number of transactions satisfying the antecedent only.
NiaARM.countrhs — Function
countrhs(ct::ContingencyTable)
countrhs(rule::Rule)Number of transactions satisfying the consequent only.
NiaARM.countnull — Function
countnull(ct::ContingencyTable)
countnull(rule::Rule)Number of transactions satisfying neither antecedent nor consequent.
Metrics
NiaARM.support — Function
support(ct::ContingencyTable)
support(rule::Rule)Fraction of transactions that satisfy both antecedent and consequent. Returns 0.0 if undefined.
NiaARM.confidence — Function
confidence(ct::ContingencyTable)
confidence(rule::Rule)Conditional probability of the consequent given the antecedent. Returns 0.0 if undefined.
NiaARM.coverage — Function
coverage(ct::ContingencyTable)
coverage(rule::Rule)Support of the antecedent.
NiaARM.rhs_support — Function
rhs_support(ct::ContingencyTable)
rhs_support(rule::Rule)Support of the consequent alone.
NiaARM.lift — Function
lift(ct::ContingencyTable)
lift(rule::Rule)Ratio between joint support and the product of antecedent and consequent supports.
NiaARM.conviction — Function
conviction(ct::ContingencyTable)
conviction(rule::Rule)Measure of implication strength that penalizes counterexamples to the rule.
NiaARM.interestingness — Function
interestingness(ct::ContingencyTable)
interestingness(rule::Rule)Heuristic metric combining confidence, normalized support, and consequent prior.
NiaARM.yulesq — Function
yulesq(ct::ContingencyTable)
yulesq(rule::Rule)Yule's Q association measure derived from the contingency table odds ratio.
NiaARM.netconf — Function
netconf(ct::ContingencyTable)
netconf(rule::Rule)Net confidence metric capturing deviation from independence normalized by antecedent coverage.
NiaARM.zhang — Function
zhang(ct::ContingencyTable)
zhang(rule::Rule)Zhang's metric providing a bounded, symmetric interestingness score.
NiaARM.leverage — Function
leverage(ct::ContingencyTable)
leverage(rule::Rule)Absolute difference between observed and expected joint support under independence.
NiaARM.amplitude — Function
amplitude(ct::ContingencyTable)
amplitude(rule::Rule)Normalized width of the numerical intervals selected in a rule.
NiaARM.inclusion — Function
inclusion(ct::ContingencyTable)
inclusion(rule::Rule)Portion of the dataset's feature space occupied by attributes present in the rule.
NiaARM.comprehensibility — Function
comprehensibility(rule)Log-scaled measure preferring rules with smaller antecedents relative to consequents.
Mining pipeline
NiaARM.mine — Function
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.
NiaARM.narm — Function
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.
Optimization setup
NiaARM.Problem — Type
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.
NiaARM.StoppingCriterion — Type
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.
NiaARM.terminate — Function
terminate(criterion, evals, iters, bestfitness)Return true when any stopping condition is met.
Algorithms
NiaARM.randomsearch — Function
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.
NiaARM.pso — Function
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.
NiaARM.ba — Function
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.
NiaARM.sa — Function
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.
NiaARM.ga — Function
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.
NiaARM.lshade — Function
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.
NiaARM.es — Function
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.
NiaARM.abc — Function
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.
NiaARM.fa — Function
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.
NiaARM.fpa — Function
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.
Utilities
NiaARM.randchoice — Function
randchoice(rng, n, k)Pick k unique indices from 1:n using rng.
NiaARM.randlevy — Function
randlevy(rng; alpha=0.01, beta=1.5)Draw a Lévy-distributed random variate using the Mantegna algorithm.
NiaARM.initpopulation — Function
initpopulation(popsize, problem, rng)Sample an initial population uniformly within the problem initialization bounds.