Changelog¶
3.0.1 - 2026-12-02¶
Fixed¶
- Installation on Python 3.15 failed with "Failed to build scikit-learn". layerbn limits scikit-learn to versions below 1.9 to keep the bin edges stable, and these versions have no packages for Python 3.15, so pip tried to build scikit-learn from source. layerbn now declares support for Python 3.11 to 3.14, so pip reports the supported versions instead. The tests now also run on Python 3.14.
layerbnwithout a command showed the error "the following arguments are required: command". It now shows the help, with the available commands and a link to the documentation.- A categorical variable with decimal values, such as a score of 0, 0.5, 1, …, 10, stopped
the run with pyAgrum 2.3: "The values passed in possibleValues … do not match database
values". Such values are now used as categories named
0,0.5,1, in numeric order. A value in the settings can be written as2or2.0. - The installation instructions explain the use of
python3 -m pipinstead ofpip, and what to do when thelayerbncommand is not on PATH.
Documentation¶
- A section on clinical cut-off values, such as z-score thresholds, instead of quantile bins.
3.0.0 - 2026-11-30¶
A redesign of how an analysis is described and run. Variables and layers are now free-form, the analysis is described in a table and a short settings file, and one command produces the figures, tables and a report. Results from version 2 can change in the ways listed under "Changed", so read this before re-running an analysis you have already reported.
To convert a version 2 spec.yml: layerbn migrate spec.yml.
Changed (breaking)¶
- No layer has a special meaning any more. The roles
outcomeandselection(dropout) are removed, together with the layer name patterns "Outcomes" and "Dropout" that the learner used internally. All layers are treated alike. - What
outcomedid for arcs between outcomes is nowarcs_within: noon a layer. - Variables of main interest are marked
target. They are the default for the analyses that need a target and are drawn with a heavy outline. - Arcs from outcomes into a dropout variable were forced in after learning. This is
removed. To obtain the same, write
requireandforbidrules. A required arc is now part of the learning, so networks can differ slightly from version 2.layerbn migratewrites these rules. - Two files instead of three, and a table instead of YAML for the variables.
variables.xlsx(or CSV) holds variables, layers and time points.settings.ymlholds the analysis settings.config.ymlis removed: the data file is set insettings.yml(data: file:) or on the command line (--data), and results go tooutput_dir. - Settings were renamed to plain language:
variantsisnetworks,n_binsisbins,thresholdiscategorical_max_levels,max_indegreeismax_parents,use_tabuissearch: tabu | greedy,bootstrap: nisbootstrap: resamples,analyses: scenariosisanalyses: profiles,knob_sweepissweep,informationisimportance. Unknown settings are now an error with a suggestion. - A variant no longer lists
outcomes. A network is defined by the layers and variables it excludes. - The notebook is optional.
layerbn runreplaces it.layerbn init --notebookwrites a short notebook that calls the same functions. - The Python interface changed.
Analysisis built from a project (Analysis.from_files), and the functions oflayerbn.bn_utilstake the layer map and the rules as arguments, with no outcome or dropout arguments.layerbn.spec,layerbn.configandlayerbn.plottingare replaced bylayerbn.design,layerbn.settings,layerbn.projectandlayerbn.figures. - Conditional mutual information is removed from the importance table. Mutual information given the parents of the target is exactly zero for every variable that is not a descendant of the target (the local Markov property of a Bayesian network), so the column carried no information for most variables. The table now gives each variable's mutual information with the target and its relation to the target in the learned structure (parent, child, co-parent, other) and the number of arcs between them.
- Missing values are reported by variable and stop the analysis, unless
data: missing: drop_rowsis set to analyse complete cases. - The profile and sweep tables have new column names (
Probability,CI 2.5%,State). The sweep table is in lower case withvariable_stateandtarget_state. -
openpyxlis a new dependency. pyAgrum is limited to>=2.1,<2.4. Quantile bin edges differ slightly between pyAgrum 2.1 and 2.3 for the same data, so results move with the version. The test suite records the edges for both and fails on a version it has not seen. Report the versions with your results (they are at the end of the report). -
A general example.
layerbn initnow creates a study with characteristics measured at baseline and an outcome at follow-up, with general names (EXPOSURE_A,MEASURE_1,OUTCOME). The previous example followed cognitive tests over three time points, which suggested that the method needs longitudinal data or is meant for one field.
Added¶
- Optional repeated measures. If the same variables were measured more than once, list
each variable once and the time points once. A layer marked
repeatedis expanded into one layer per time point, in time order, and the data columns are built fromdata: column_pattern:({variable}_{time}). A variable can be limited to some time points. layerbn run: one command that reads the files, checks them against the data, learns every network, runs the analyses and writesresults/withreport.html, figures (PNG and PDF), tables (CSV and one Excel file), the networks (.bifxml) and a copy of the inputs.--fastis a quick trial run, marked as such in the report.layerbn check: reads the settings, the variables table and the data without fitting anything, and reports problems in plain language.--figuredraws the layers.layerbn init --blankfor empty tables, and a workbook with dropdown lists for layer names, yes/no fields and types, and an instructions sheet.layerbn migrateconverts a version 2spec.yml.- Missing values as a state of their own.
data: missing: categorykeeps empty cells as a stateMissingthat the network models like any other value, so it can show whether being missing is itself informative. The choice (category,drop_rowsorerror) can be made per variable in a newmissingcolumn of the variables table. In the figuresMissingis drawn last, grey and in italics; it can be used as a value in profiles and sweeps. - Per-variable binning:
bins,cutpoints(your own thresholds, for example an established cut-off) andtype(categoricalorcontinuous) in the variables table. - Layers can differ in whether arcs inside them are allowed (
arcs_within). - Names can be labels. Variables in
settings.ymlcan be written by column name or by label, and a layer name stands for a repeated layer at every time point. - Several networks in one run, with a comparison of arc stability between them.
- Figures drawn in matplotlib, with no Graphviz needed: the network with layers as bands in causal order (repeated measures aligned across time points), every arc labelled with its stability, arcs routed around the boxes they pass, arc stability, information about each target, profiles, sweep, network comparison, and the bins. PDFs keep text as editable text.
- An interactive explorer for each network (
networks/<name>_explorer.html, orstudy.explore()in a notebook). The distribution of every variable is drawn inside its node. Click states to set evidence and every other distribution updates, with the prior kept for comparison. The page also shows each conditional probability table and arc stability. It is one HTML file that needs no Python or internet connection. The inference runs in the page and is tested against pyAgrum. - The report contains how to read each part, an automatically written methods paragraph, the settings, the versions of the software and a checksum of each input file.
- The bins table has the exact bin edges next to the readable names.
- A documentation site (umcu.github.io/layerbn),
built with MkDocs Material from
docs/: a guided first run, the steps for your own study, how to read each result, a full reference including the Python API, and the error messages. It shows a live example report and explorer, generated from the current code at every build.mkdocs build --strictruns in CI. - The explorer fits the network to the window on opening, and on a narrow screen puts the side panel below the network.
- New logo, drawn in code (
docs/assets/build_logo.py), in a light and a dark version. - A larger test suite: 192 tests covering the variables table, the settings, the layer
guarantee on learned networks and on every bootstrap resample, recovery of a known
structure, the figures, the explorer's inference against pyAgrum, the command line from
inittoreport.html, migration, and the notebook.
Fixed¶
- The BDeu score could not be used. Selecting it raised an error from pyAgrum. It was not covered by a test.
- PDF figures did not keep editable text because the font setting was read at the wrong time.
- Unquoted
YesandNoin a profile were read by YAML as true and false and did not match categories calledYesandNo. They are matched now. - A mistake in capital letters (
AgeforAGE) now gets a suggestion in every message that offers one. - CSV files with semicolons (as saved by Excel in several countries) are read.
Removed¶
- The Graphviz-based drawing (
layerbn.plotting),layerbn.config,config.yml, theoutcomeandselectionroles, and theselection_parentsandarcs_between_outcomessettings.
2.0.0 - 2026-08-20¶
Renamed from vcibayes to layerbn. The method was never specific to vascular cognitive
impairment, and the name said otherwise. Nothing about the analysis changed in the rename.
Fixed mutual information that was silently dropped for some variables, a bootstrap that
learned under a different prior than the reported network, constraints.forbid being ignored
for outcome-to-dropout arcs, and a removed pandas function. Added a test suite and continuous
integration. Capped scikit-learn below 1.9, because that release changes the quantile bin
edges.
1.2.1 and earlier¶
Released as vcibayes. See the git history.