build.idgraph: Constructs interdependencies graph

View source: R/rmcfs.R

build.idgraphR Documentation

Constructs interdependencies graph

Description

Constructs the ID-Graph (igraph/idgraph object) from mcfs_result object returned by mcfs function. The number of top features included and the number of ID-Graph edges can be customized.

Usage

build.idgraph(mcfs_result, 
                      size = NA, 
                      size_ID = NA, 
                      self_ID = FALSE,
                      outer_ID = FALSE,
                      orphan_nodes = FALSE, 
                      size_ID_mult = 3, 
                      size_ID_max = 100)

Arguments

mcfs_result

results returned by mcfs function.

size

number of top features to select. If size = NA, then size is defined by mcfs_result$cutoff_value parameter.

size_ID

number of interdependencies (edges in ID-Graph) to be included. If size_ID = NA, then parameter size_ID is defined by multiplication size_ID_mult*size.

self_ID

if self_ID = TRUE, then include self-loops from ID-Graph.

outer_ID

if outer_ID = TRUE, then include include all interactions between a feature from the top set features (defined by size parameter) with any other feature.

orphan_nodes

if plot_all_nodes = TRUE, then include all nodes, even if they are not connected to any other node (isolated nodes).

size_ID_mult

If size_ID_mult = 3 there will be 3 times more edges than features (nodes) presented on the ID-Graph. It works only if size = NA and size_ID = NA

size_ID_max

maximum number of interactions to be included from ID-Graph (the upper limit).

Value

igraph/idgraph S3 object that can be: plotted in R, exported to graphML (XML format) or saved as csv or rds files.

Examples

  ## Not run: ###dontrunbegin

  # create input data
  adata <- artificial.data(rnd_features = 10)
  showme(adata)
  
  # Parametrize and run MCFS-ID procedure
  result <- mcfs(class~., adata, cutoffPermutations = 0, featureFreq = 50,
                  buildID = TRUE, finalCV = FALSE, finalRuleset = FALSE,
                  threadsNumber = 2)

  # build interdependencies graph for top 6 features 
  # and top 12 interdependencies and plot all nodes
  gid <- build.idgraph(result, size = 6, size_ID = 12, orphan_nodes = TRUE)
  plot(gid, label_dist = 1)

  # Export graph to graphML (XML structure)
  path <- tempdir()
  igraph::write_graph(gid, file = file.path(path, "artificial.graphml"), 
            format = "graphml", prefixAttr = FALSE)

  
## End(Not run)###dontrunend

rmcfs documentation built on Sept. 11, 2024, 8:41 p.m.

Related to build.idgraph in rmcfs...