Introduction

Trying to make 2D and 3D plots of individuals remaining data.

Setup Code

library('plotly')

setwd("/Volumes/GoogleDrive/My\ Drive/Research/R/Specialization\ and\ Lexicase\ GPEM\ Paper/")

x_axis_template <- list(title = 'generation')
y_axis_template <- list(title = 'lexicase step')
z_axis_template <- list(title = 'number of individuals remaining')
z_axis_template_log <- list(title = 'number of individuals remaining', type="log")

Make 2D Plots

These two are means.

The first, once a lexicase stops (i.e. is down to one individual), does not contribute any data points to the “lexicase steps” to its right. The second one, once a lexicase stops, includes a 1 in every step to its right. (Same idea for medians below.)

twoD_mean <- read.csv("data/twoD-mean.csv", header=TRUE)
twoD_with_ones_mean <- read.csv("data/twoD-with-ones-mean.csv", header=TRUE)

twoD_mean_plot <- ggplot(twoD_mean, aes(x=step, y=value)) +
  geom_point(shape=1) +
  scale_y_continuous(trans='log10') + 
  coord_cartesian(xlim = c(0,25)) +
  facet_wrap( ~ problem, nrow = 2)
ggplotly(twoD_mean_plot)
twoD_with_ones_mean_plot <- ggplot(twoD_with_ones_mean, aes(x=step, y=value)) +
  geom_point(shape=1) +
  scale_y_continuous(trans='log10') + 
  coord_cartesian(xlim = c(0,25)) +
  facet_wrap( ~ problem, nrow = 2)
ggplotly(twoD_with_ones_mean_plot)

These two are medians.

twoD_median <- read.csv("data/twoD-median.csv", header=TRUE)
twoD_with_ones_median <- read.csv("data/twoD-with-ones-median.csv", header=TRUE)

twoD_median_plot <- ggplot(twoD_median, aes(x=step, y=value)) +
  geom_point(shape=1) +
  scale_y_continuous(trans='log10') + 
  coord_cartesian(xlim = c(0,25)) +
  facet_wrap( ~ problem, nrow = 2)
ggplotly(twoD_median_plot)
twoD_with_ones_median_plot <- ggplot(twoD_with_ones_median, aes(x=step, y=value)) +
  geom_point(shape=1) +
  scale_y_continuous(trans='log10') +
  #scale_x_continuous(trans='log10') +
  coord_cartesian(xlim = c(0,25)) +
  facet_wrap( ~ problem, nrow = 2)
ggplotly(twoD_with_ones_median_plot)
twoD_with_ones_median_plot_long <- ggplot(twoD_with_ones_median, aes(x=step, y=value)) +
  geom_point(shape=1) +
  scale_y_continuous(trans='log10') +
  #scale_x_continuous(trans='log10') +
  # coord_cartesian(xlim = c(0,25)) +
  facet_wrap( ~ problem, nrow = 2)
ggplotly(twoD_with_ones_median_plot_long)

Last Index of Zero

Import Data

last_index_of_zero_mean <- data.matrix(read.csv("data/last-index-of-zero-mean.csv", header=FALSE))
last_index_of_zero_median <- data.matrix(read.csv("data/last-index-of-zero-median.csv", header=FALSE))
last_index_of_zero_with_ones_mean <- data.matrix(read.csv("data/last-index-of-zero-with-ones-mean.csv", header=FALSE))
last_index_of_zero_with_ones_median <- data.matrix(read.csv("data/last-index-of-zero-with-ones-median.csv", header=FALSE))

Make 3D Plots

last_index_of_zero_mean_plot <- plot_ly(z = ~last_index_of_zero_mean) %>% add_surface() %>%
  layout(
    title = "Last Index of Zero - Mean",
    scene = list(
      xaxis = x_axis_template,
      yaxis = y_axis_template,
      zaxis = z_axis_template
    ))
last_index_of_zero_mean_plot
last_index_of_zero_median_plot <- plot_ly(z = ~last_index_of_zero_median) %>% add_surface() %>%
  layout(
    title = "Last Index of Zero - Median",
    scene = list(
      xaxis = x_axis_template,
      yaxis = y_axis_template,
      zaxis = z_axis_template
    ))
last_index_of_zero_median_plot
### Ignore these for now

# last_index_of_zero_with_ones_mean_plot <- plot_ly(z = ~last_index_of_zero_with_ones_mean) %>% add_surface() %>%
#   layout(
#     title = "Last Index of Zero - Mean (with ones)",
#     scene = list(
#       xaxis = x_axis_template,
#       yaxis = y_axis_template,
#       zaxis = z_axis_template
#     ))
# last_index_of_zero_with_ones_mean_plot
# 
# last_index_of_zero_with_ones_median_plot <- plot_ly(z = ~last_index_of_zero_with_ones_median) %>% add_surface() %>%
#   layout(
#     title = "Last Index of Zero - Median (with ones)",
#     scene = list(
#       xaxis = x_axis_template,
#       yaxis = y_axis_template,
#       zaxis = z_axis_template
#     ))
# last_index_of_zero_with_ones_median_plot

Make 3D Log Plots

last_index_of_zero_mean_plot <- plot_ly(z = ~last_index_of_zero_mean) %>% add_surface() %>%
  layout(
    title = "Last Index of Zero - Mean",
    scene = list(
      xaxis = x_axis_template,
      yaxis = y_axis_template,
      zaxis = z_axis_template_log
    ))
last_index_of_zero_mean_plot
last_index_of_zero_median_plot <- plot_ly(z = ~last_index_of_zero_median) %>% add_surface() %>%
  layout(
    title = "Last Index of Zero - Median",
    scene = list(
      xaxis = x_axis_template,
      yaxis = y_axis_template,
      zaxis = z_axis_template_log
    ))
last_index_of_zero_median_plot