arete (Automated REtrieval from TExt) Automated Report

knitr::opts_chunk$set(echo = TRUE)

1. Details


FILE: r params$report_data[["file_name"]]

SPECIES: r params$report_data[["species_name"]]

2. Data


2.1 - Ground truth data

  x <- knitr::kable(params$report_data[["human_data"]],
    format = "html",
    table.attr = "style='width:30%;'",
    align = c("c", "c")
    #, caption = "This is the table caption"
    , col.names = c("Latitude", "Longitude")
  )

  kableExtra::kable_styling(
      kableExtra::kable_classic_2(x),
    position = "left"
  )

2.2 - Model data

  x <- knitr::kable(params$report_data[["model_data"]],
    format = "html",
    table.attr = "style='width:30%;'",
    align = c("c", "c")
    #, caption = "This is the table caption"
    , col.names = c("Latitude", "Longitude")
  )

  kableExtra::kable_styling(
      kableExtra::kable_classic_2(x),
    position = "left"
  )

2.3 - Scatterplots

for (dat in c("human_data", "model_data")){
  plot_data = params$report_data[[dat]]
  colnames(plot_data) = c("Latitude", "Longitude")
  plot_data = plot_data[,c("Longitude", "Latitude")]

  plot = ggplot2::ggplot(plot_data, ggplot2::aes(x = Longitude, y = Latitude)) +
  ggplot2::geom_point(alpha = 0.7, shape = 16) +
  ggplot2::labs(
    x = "Longitude",
    y = "Latitude",
  ) +
  ggplot2::theme_minimal(base_size = 14) +
  ggplot2::theme(
    plot.title = ggplot2::element_text(face = "bold", size = 18, hjust = 0.5),
    plot.subtitle = ggplot2::element_text(size = 12, hjust = 0.5),
    legend.position = "right",
    panel.grid.minor = ggplot2::element_blank(),
    panel.grid.major = ggplot2::element_line(color = "grey80", linetype = "dashed")
  )

  if (dat == "human_data"){
    plot = plot + ggplot2::labs(title = "Ground truth data")
  } else if (dat == "model_data"){
    plot = plot + ggplot2::labs(title = "Model data")
  }

  plot(plot)
}

3. Analysis


3.1 - Non-intersecting species

For the above file the following NON-INTERSECTING SPECIES were found: Ground truth \| Model (r params$global_extra[1], r params$global_extra[2]).

3.2 - Euclidean distance

Mean minimum euclidean distance is r mean(params$report_data[["euc_dist"]]).

3.3 - Contingency table

  x = params$report_data[["contingency_table"]]
  row.names(x) = c("Model", "Human")

  x <- knitr::kable(x,
    format = "html",
    table.attr = "style='width:30%;'",
    align = c("c", "c")
    #, caption = "This is the table caption"
    , col.names = c("Model", "Human")
  )

  kableExtra::kable_styling(
      kableExtra::kable_classic_2(x),
    position = "left"
  )

-- in -->

r params$report_data[["contingency_table"]][1,1] - params$report_data[["contingency_table"]][1,2] points unique to the model.

r params$report_data[["contingency_table"]][2,2] - params$report_data[["contingency_table"]][2,1] points unique to ground truth.

3.5 - Confusion matrix

Consider the model output our predicted values and the ground truth data as the observed values. You can then conceptualize the output as being made of True Positives (TP), data points both in the model output and the ground truth; False Negatives (FN), data points in the ground truth but not in the model output and False Positives (FP), data points in the model output but not in the ground truth, the often called “hallucinations”.

::: {#testdiv style="margin-bottom:50px;"}

  x = params$report_data[["confusion_matrix"]]

  x <- cbind(c("TRUE", "FALSE"), params$report_data[["confusion_matrix"]])

  x <- cbind(c("Observed", "Observed"), x)

  x <- knitr::kable(x,
    format = "html",
    table.attr = "style='width:30%;'",
    align = c("c", "c"),
    col.names = c(" ", "  ", "TRUE", "FALSE"),
    row.names = FALSE
  )

  x <- kableExtra::kable_styling(
    kableExtra::add_header_above(
      kableExtra::kable_classic_2(x),
      c(" " = 1, "  " = 1, "Predicted" = 2)
    ),
    position = "left"
  )

  kableExtra::collapse_rows(x, columns = c(1), valign = "middle")

:::

3.7 - Performance metrics

Values of four commonly used metrics to report performance: accuracy, sensitivity, specificity, precision and F1. We highly recommend interested users to first consult the documentation of arete::performance_report() and its within referenced sources between using these metrics for model reporting.

  perf_metrics = matrix(nrow = 4, ncol = 2, byrow = TRUE,
                        c("Accuracy", params$report_data[["accuracy"]],
                          "Recall", params$report_data[["sensitivity"]],
                          "Precision", params$report_data[["precision"]],
                          "F1", params$report_data[["f1"]]
                          ),
                        dimnames = list(c(), c("Metric", "Value"))
                        )

    perf_metrics <- knitr::kable(perf_metrics,
      format = "html",
      table.attr = "style='width:30%;'",
      align = c("c", "c")
      #, caption = "This is the table caption"
      #, col.names = c("", "TRUE", "FALSE")
  )

  kableExtra::kable_styling(
      kableExtra::kable_classic_2(perf_metrics),
    position = "left"
  )


Try the arete package in your browser

Any scripts or data that you put into this service are public.

arete documentation built on Nov. 5, 2025, 6:31 p.m.