Learn R Programming

rmcfs (version 1.1.0)

build.idgraph: 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, 
                      plot_all_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.
plot_all_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

Run this code
### Set up java parameter and load rmcfs package
  options(java.parameters = "-Xmx4g")
  library(rmcfs)
  
  # create input data
  adata <- artificial.data(rnd.features = 10)
  info(adata)
  
  # Parametrize and run MCFS-ID procedure
  result <- mcfs(class~., adata, projections = 200, projectionSize = 4, 
                 cutoffPermutations = 5, finalCV = FALSE, finalRuleset = FALSE, 
                 threadsNumber = 2)

  # build interdependencies graph (all default parameters).
  gid <- build.idgraph(result)
  plot(gid)
  
  # build interdependencies graph for top 6 features 
  # and top 12 interdependencies and plot all nodes
  gid <- build.idgraph(result, size = 6, size_ID = 12, plot_all_nodes = TRUE)
  plot(gid, label.dist = 1)

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

Run the code above in your browser using DataLab