Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/alexplatasl/dplbnde/llms.txt

Use this file to discover all available pages before exploring further.

DErand implements the DE/rand/1 and DE/rand/2 mutation strategies. Unlike DEbest, the base vector is randomly selected from the population rather than being the current best individual — promoting broader exploration.

Usage

DErand(
  NP = 40,
  G = 100,
  data,
  class.name,
  F = 0.5,
  CR = 0.7,
  mutation.pairs = c(1, 2),
  crossover = c("bin", "exp"),
  structure = c("nb", "tancl", "tan", "hc"),
  edgelist = NULL,
  verbose = 25,
  ...
)

Parameters

NP
integer
default:"40"
Population size. Must be > 5; values ≤ 5 are reset to 40.
G
integer
default:"100"
Maximum generations. Values ≤ 1 are reset to 100.
data
data.frame
required
Data frame from which to learn the classifier.
class.name
character
required
Name of the class variable column in data.
F
numeric
default:"0.5"
Mutation factor in [0, 2].
CR
numeric
default:"0.7"
Crossover rate in [0, 1].
mutation.pairs
integer
default:"1"
Number of difference vector pairs: 1 (DE/rand/1) or 2 (DE/rand/2).
crossover
character
default:"bin"
Crossover type: "bin" (binomial) or "exp" (exponential).
structure
character
default:"nb"
BN structure: "nb", "tan", "tancl", or "hc".
edgelist
matrix
Optional custom topology as an edges × 2 matrix (from, to).
verbose
integer
default:"25"
Print progress every this many generations. 0 suppresses output.
...
Extra arguments forwarded to bnclassify::tan_cl or bnclassify::tan_hc.

Return value

Returns an object of class DE with the same fields as DEbest: Best, BestCLL, pobFinal, CLLPobFinal, N.evals, convergence, evaluations.

DErand vs DEbest

AspectDEbestDErand
Base vectorAlways the best individualRandom population member
ExplorationLess — converges fasterMore — less prone to premature convergence
ExploitationStrongerWeaker
Best forUnimodal or well-behaved landscapesMultimodal landscapes

Examples

library(dplbnDE)
data(car)

# DE/rand/2/bin with TAN structure
result <- DErand(
  NP = 20, G = 25,
  data = car,
  class.name = names(car)[7],
  F = 0.5, CR = 0.5,
  mutation.pairs = 2,
  crossover = "bin",
  structure = "tan",
  verbose = 5
)

print(result)
predictions <- predict(result$Best, car)
accuracy(predictions, car$class)