View source: R/random_contexts.R
| RandomContext | R Documentation |
Functions to generate synthetic formal contexts using advanced statistical distributions. These methods allow creating datasets that mimic real-world properties (non-uniform density) or randomizing existing contexts while preserving their structural properties.
RandomContext(
n_objects,
n_attributes,
density = 0.1,
distribution = "uniform",
alpha = 1,
...
)
n_objects |
(integer) Number of objects. |
n_attributes |
(integer) Number of attributes. |
density |
(numeric) Expected density of the context (proportion of 1s). Used for uniform distribution. |
distribution |
(character) The distribution to use for generating the context.
|
alpha |
(numeric) Concentration parameter for the Dirichlet distribution. Low values (e.g., 0.1) produce very skewed distributions (some objects have few attributes, others many). High values produce more uniform row sums. Default is 1.0. |
... |
Additional arguments passed to internal methods. |
A FormalContext object.
# 1. Uniform Random Context
fc_uni <- RandomContext(10, 5, density = 0.2)
print(fc_uni)
# 2. Dirichlet Random Context (Mimicking real data structure)
# Objects will have varying 'sizes' (number of attributes)
fc_dir <- RandomContext(10, 5, distribution = "dirichlet", alpha = 0.5)
print(fc_dir)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.