Skip to content

4 · Choose the settings

settings.yml specifies how the analysis is run. For a first run, only the name of the data file needs to be entered. All other settings have default values, and each setting is described in a comment in the file.

Opening the file

settings.yml is a plain text file. Open it in a text editor:

TextEdit: right-click the file and select Open With → TextEdit. If formatting buttons are shown, select Format → Make Plain Text. You can also use VS Code.

Notepad: right-click the file and select Open with → Notepad. You can also use VS Code.

Do not use Word. Word adds formatting that makes the file unreadable for layerbn.

Required setting: the data file

In the data: block, enter the name of the data file in the data folder:

data:
  file: data/my_cohort.csv

The path is relative to the folder that contains settings.yml. data/my_cohort.csv refers to the file my_cohort.csv in the data folder of the project. You can also use a full path:

  file: '/Users/me/Documents/cohort/my_cohort.csv'      # macOS
  file: 'D:\Research\cohort\my_cohort.csv'               # Windows

Common settings

name: Example cohort study                   # title of the report
description: >
  800 participants, outcome after two years of follow-up. Shown in the report.

data:
  file: data/my_cohort.csv
  missing: category           # empty cells become a state 'Missing'; or drop_rows, or error

bootstrap:
  resamples: 200              # 20 for trial runs, 200 or more for reported results

Each resample learns the complete network again, so the run time increases with resamples.

YAML syntax

The file uses the YAML format. The main rules are:

Rule Example
A setting consists of a name, a colon, a space and a value bins: 4
Indentation defines the structure. Use spaces, not tabs data: followed by file: ..., indented by two spaces
Text after # is a comment bins: 4 # four groups
Enclose text with special characters in single quotes file: 'D:\data\my file.csv'

Validation

An unknown or misspelled setting stops the check with a suggestion, for example "did you mean resamples?". Settings are never ignored without a message.

Other settings

The other blocks are optional:

Block Purpose Page
discretisation Default number and type of groups for continuous variables. For clinical thresholds, use cutpoints per variable instead Clinical cut-off values
learning Score, search algorithm, maximum number of parents, random seed Reference
data: missing Handling of missing values, globally or per variable Missing values
constraints Forbidden or required arcs Rules for arcs
networks Several networks, for example without a particular layer Several networks
analyses Profiles and a sweep Profiles and sweeps

Without an analyses block, the run produces the network, the stability of each arc and the information about each target. Profiles and sweeps are only produced when they are defined.

Next: check and run