From 835c1c58f6156666718bbeca21e40dfa9e849e0d Mon Sep 17 00:00:00 2001 From: serkor1 <77464572+serkor1@users.noreply.github.com> Date: Thu, 16 Jan 2025 15:06:11 +0100 Subject: [PATCH] :books: Added function introduction * The classification section has a primer of factors * The regression section is empty... --- docs/classification_functions.qmd | 47 ++++++++++++++++++++++++++++++- docs/regression_functions.qmd | 3 +- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/docs/classification_functions.qmd b/docs/classification_functions.qmd index 7a221499..33b08a87 100644 --- a/docs/classification_functions.qmd +++ b/docs/classification_functions.qmd @@ -1,3 +1,48 @@ +--- +format: + html: + code-overflow: wrap +execute: + cache: true +knitr: + opts_chunk: + comment: "#>" + messages: true + warning: false +--- + # Classification functions {.unnumbered} -In this section all classification evaluation metrics are listed. \ No newline at end of file +In this section all available classification metrics and related documentation is described. Common for all classifcation functions is that they use the class `factor`. + +## A primer on factors + + Consider a classification problem with three classes: `A`, `B`, and `C`. The actual vector of `factor` values is defined as follows: + +```{r} +## set seed +set.seed(1903) + +## actual +factor( + x = sample(x = 1:3, size = 10, replace = TRUE), + levels = c(1, 2, 3), + labels = c("A", "B", "C") +) +``` + + Here, the values 1, 2, and 3 are mapped to `A`, `B`, and `C`, respectively. Now, suppose your model does not predict any `B`'s. The predicted vector of `factor` values would be defined as follows: + +```{r} +## set seed +set.seed(1903) + +## predicted +factor( + x = sample(x = c(1, 3), size = 10, replace = TRUE), + levels = c(1, 2, 3), + labels = c("A", "B", "C") +) +``` + + In both cases, $k = 3$, determined indirectly by the `levels` argument. \ No newline at end of file diff --git a/docs/regression_functions.qmd b/docs/regression_functions.qmd index c3932423..e91448ea 100644 --- a/docs/regression_functions.qmd +++ b/docs/regression_functions.qmd @@ -1,3 +1,4 @@ # Regression functions {.unnumbered} -In this section all regression evaluation metrics are listed. \ No newline at end of file +In this section all available regression metrics and related documentation is described. Common for all regression functions is that they use the class `numeric`. +