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.

This guide walks through a complete example using the built-in car dataset (1728 observations, 7 variables from the UCI repository).
1

Load the package and data

library(dplbnDE)
data(car)
# 7 columns: buying, maint, doors, persons, lug_boot, safety, class
names(car)
2

Run DEbest — DE/best/1/bin variant

run.DEbest <- DEbest(
  NP = 30, G = 25,
  data = car,
  class.name = names(car)[7],
  crossover = "bin",
  mutation.pairs = 1,
  structure = "tan",
  F = 0.5, CR = 0.55,
  edgelist = NULL,
  verbose = 5
)
Progress is printed every 5 generations:
Gen:  5 	 CLL=  -1911.61 	 NP=  30
Gen:  10 	 CLL=  -1532.554 	 NP=  30
Gen:  15 	 CLL=  -1392.074 	 NP=  30
Gen:  20 	 CLL=  -1252.369 	 NP=  30
Gen:  25 	 CLL=  -1181.117 	 NP=  30
3

Inspect the results

print(run.DEbest)
Number of evaluations: 	 780
Final population size: 	 30

Summary results of fitness in final population:

Best CLL: 	 -1181.117
Worst CLL: 	 -1251.721
Median: 	 -1218.063
Std. Dev.: 	 17.96752
4

Plot convergence

plot(run.DEbest)
This produces two panels: a histogram of CLL values in the final population, and a convergence plot of best CLL vs. number of evaluations.
5

Predict and evaluate accuracy

predictions <- predict(run.DEbest$Best, car)
accuracy(predictions, car$class)
The $Best field is a bnc_bn object. Use any bnclassify function on it for further analysis.
Higher NP and G values improve solution quality at the cost of computation time. The adaptive variants (lshade, jade, jso) often achieve better CLL with fewer evaluations than fixed-parameter DEbest/DErand.

Next steps

Concepts

Understand why CLL optimization improves classifiers

All algorithms

Explore all 10 DE variants and their parameters

Structure learning

Choose the right BN structure for your data

Custom topology

Define your own BN edge list

Build docs developers (and LLMs) love