figure_comparison.as_data: Figure Comparison

View source: R/graphics.R

figure_comparison.as_dataR Documentation

Figure Comparison

Description

Represents a bar plot with the percentage of times each algorithm is selected by ML compared with the optimal selection (according to the response variable or KPI).

Usage

## S3 method for class 'as_data'
figure_comparison(
  data_object,
  ties = "different_data_points",
  main = "Option Comparison",
  labels = NULL,
  mllabel = NULL,
  test = TRUE,
  predictions,
  by_families = FALSE,
  stacked = TRUE,
  color_list = NULL,
  legend = TRUE,
  ordered_option_names = NULL,
  xlab = "Criteria",
  ylab = "Instances (%)",
  ...
)

Arguments

data_object

object of class as_data.

ties

How to deal with ties. Must be one of:

  • "different_data_points": Tied algorithms in the optimal selection are all counted as different data points (increasing the total number of x values and therefore giving all of the tied algorithms the same weight).

  • "ml_if_optimal": For tied algorithms, the one selected by ML is chosen if it corresponds to the optimal one. Otherwise, the same as in option different_data_points is done.

  • "ml_selection": For tied algorithms, the one prefered by the ML is chosen.

main

an overall title for the plot.

labels

character vector with the labels for each of the algorithms. If NULL, the y names of the data_object names will be used.

mllabel

character vector with the labels for the Optimal and ML bars. If NULL, default names will be used.

test

flag that indicates whether the function should use test data or training data.

predictions

a data frame with the predicted KPI for each algorithm (columns) and for each instance (rows).

by_families

boolean indicating whether the function should represent data by families or not. The family information must be included in the data_object parameter.

stacked

boolean to choose between bar plot and stacked bar plot.

color_list

list with the colors for the plots. If NULL, or insufficient number of colors, the colors will be generated automatically.

legend

boolean to activate or deactivate the legend in the plot.

ordered_option_names

vector with the name of the columns of data_object y variable in the correct order.

xlab

a label for the x axis.

ylab

a label for the y axis.

...

other parameters.

Value

A ggplot object representing the bar plot with the percentage of times each algorithm is selected by ML compared with the optimal selection (according to the response variable or KPI).

Examples

data(branchingsmall)
data <- partition_and_normalize(branchingsmall$x, branchingsmall$y)
training <- AStrain(data, method = "glm")
predict_test <- ASpredict(training, newdata = data$x.test)
figure_comparison(data, predictions = predict_test)

ASML documentation built on April 3, 2025, 8:47 p.m.