The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
quantify()
evaluates whether the top event occurs under each
scenario. With the default prob = FALSE, inputs are
binary (failed / not failed) for each basic event.
This vignette covers:
formulate()
directly.library(tidyfault)
library(dplyr)
library(purrr)
library(tibble)
data("db_nodes")
data("db_edges")
f <- curate(db_nodes, db_edges) |>
equate() |>
formulate()
sort(names(formals(f)))#> [1] "AF" "AUF" "BF" "DC" "HF" "MF" "NF" "SF"
Any scenario can be passed as named arguments matching
formals(f):
#> [1] 2
quantify() on a data frameBundled db_outcomes_binary
holds several rows of 0/1 inputs:
#> # A tibble: 6 × 9
#> scenario DC AF SF BF NF AUF HF MF
#> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 1 0 1 0 1 0 0 0 1
#> 2 2 0 0 1 0 1 0 0 1
#> 3 3 1 0 0 1 0 0 0 0
#> 4 4 0 1 0 0 1 0 1 0
#> 5 5 0 0 0 1 0 1 0 1
#> 6 6 1 0 0 0 1 0 0 1
quantify()
returns one logical top-event outcome per row:
#> [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE
For larger batches, build a tibble of draws (one column per basic
event), then call quantify() once. The example below uses
it_security_probs
as Bernoulli parameters and fixes the seed for reproducibility.
data("it_security_nodes")
data("it_security_edges")
data("it_security_probs")
f_sec <- formulate(equate(curate(it_security_nodes, it_security_edges)))
set.seed(123)
n_binary <- 5000
batch_binary <- it_security_probs |>
map(~ rbinom(n_binary, size = 1, prob = .x)) |>
as_tibble()
outcomes_batch <- quantify(f_sec, newdata = batch_binary)
table(outcomes_batch)#> outcomes_batch
#> FALSE TRUE
#> 4914 86
#> [1] 0.0172
fast = TRUE (default).names(formals(f_sec)).| Input | quantify() usage |
|---|---|
| One scenario | Named vector, list, or one-row data frame |
| Many scenarios | Data frame / tibble with one column per basic event |
| Top event type | Logical vector (TRUE = top event occurred) |
For probabilities instead of 0/1 inputs, see quantify()-ing probabilities.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.