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.

DEbest implements the DE/best/1 and DE/best/2 mutation strategies with either binomial or exponential crossover.

Usage

DEbest(
  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 number of generations. Values ≤ 1 are reset to 100.
data
data.frame
required
Data frame from which to learn the classifier. Must contain the class variable.
class.name
character
required
Name of the class variable column in data.
F
numeric
default:"0.5"
Mutation factor. Must be in [0, 2]; values outside this range are reset to 0.5.
CR
numeric
default:"0.7"
Crossover rate. Must be in [0, 1]; values outside this range are reset to 0.7.
mutation.pairs
integer
default:"1"
Number of difference vector pairs in mutation: 1 (DE/best/1) or 2 (DE/best/2).
crossover
character
default:"bin"
Crossover type: "bin" (binomial) or "exp" (exponential).
structure
character
default:"nb"
BN structure learning method: "nb" (Naive Bayes), "tan" or "tancl" (TAN via Chow-Liu), "hc" (Hill-Climbing).
edgelist
matrix
Optional custom BN topology as an edges × 2 matrix with columns (from, to). Overrides structure.
verbose
integer
default:"25"
Print progress every this many generations. Set to 0 to suppress output.
...
Additional arguments passed to bnclassify::tan_cl or bnclassify::tan_hc (e.g., k for hill-climbing folds).

Return value

An object of class DE containing:
Best
bnc_bn
The Bayesian Network with the highest CLL in the final population.
BestCLL
numeric
Conditional Log-Likelihood of the best network.
pobFinal
list
All bnc_bn objects in the final population.
CLLPobFinal
numeric vector
CLL values for each member of the final population.
N.evals
integer
Total number of CLL evaluations performed.
convergence
numeric vector
Best CLL recorded at each generation.
evaluations
integer vector
Cumulative evaluations at each generation.

Examples

library(dplbnDE)
data(car)

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

print(result)
plot(result)

# Predict using the best network
predictions <- predict(result$Best, car)
accuracy(predictions, car$class)