Learn R Programming

rmcfs (version 1.1.1)

plot.mcfs: Plots various MCFS result components

Description

Plots various aspects of the MCFS-ID result.

Usage

"plot"(x, type = c("ri", "id", "distances", "features", "cv", "cmatrix"), size = NA, plot_permutations = F, measure = c("acc", "wacc"), l_margin = 10, cex = 1, ...)

Arguments

x
'mcfs' S3 object - result of the MCFS-ID experiment returned by mcfs function.
type
  • ri plots top features set with their RIs as well as max RI obtained from permutation experiments. Red color denotes important features.
  • id plots top ID values obtained from the MCFS-ID.
  • distances plots distances (convergence diagnostics of the algorithm) between subsequent feature rankings obtained during the MCFS-ID experiment.
  • features plots top features set along with their RI. It is a horizontal barplot that shows important features in red color and unimportant in grey.
  • cv plots cross validation results based on top features.
  • cmatrix plots the confusion matrix obtained on all $s \cdot t$ trees.
size
number of features to plot.
plot_permutations
if type = "ri" and plot_permutations = T, then it additionally shows horizontal lines that correspond to max RI values obtained from each single permutation experiment.
measure
if type="cv", then it determines the type of accuracy shown in the plot: weighted or unweighted accuracy ("wacc" or "acc").
cex
size of fonts.
l_margin
if type = "features", then it determines the size of the left margin of the plot.
...
additional plotting parameters.

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)
  showme(adata)
  
  # Parametrize and run MCFS-ID procedure
  result <- mcfs(class~., adata, projections = 100, projectionSize = 4, 
                 cutoffPermutations = 3, finalCV = FALSE, finalRuleset = TRUE, 
                 threadsNumber = 2)

  # Plot & print out distances between subsequent projections. 
  # These are convergence MCFS-ID statistics.
  plot(result, type="distances")
  print(result$distances)
  
  # Plot & print out 50 most important features.
  plot(result, type="ri", size = 50)
  # Show max RI values from permutation experiment.
  plot(result, type = "ri", size = 50, plot_permutations = TRUE)
  print(head(result$RI, 50))
  
  # Plot & print out 50 strongest feature interdependencies.
  plot(result, type = "id", size = 50)
  print(head(result$ID, 50))
  
  # Plot features ordered by RI_norm. Parameter 'size' is the number of 
  # top features in the chart. We set this parameter a bit larger than cutoff_value.
  plot(result, type = "features", size = result$cutoff_value * 1.1, cex = 1)
  # Here we set 'size' at fixed value 10.
  plot(result, type = "features", size = 10)
  
  # Plot cv classification result obtained on top features.
  # In the middle of x axis red label denotes cutoff_value.
  # plot(result, type = "cv", measure = "wacc", cex = 0.8)
  
  # Plot & print out confusion matrix. This matrix is the result of 
  # all classifications performed by all decision trees on all s*t datasets.
  plot(result, type = "cmatrix")

Run the code above in your browser using DataLab