Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see https://quarto.org.
Running Code
When you click the Render button a document will be generated that includes both content and the output of embedded code. You can embed code like this:
# ============================================================# Classification Metrics: Code Base Submission# Assignment: Evaluating Classification Model Performance# Positive class: female# ============================================================# ---------------------------# 1. Load packages and data# ---------------------------# Install ggplot2 once if needed:# install.packages("ggplot2")library(ggplot2)url <-"https://raw.githubusercontent.com/acatlin/data/refs/heads/master/penguin_predictions.csv"penguins <-read.csv(url, check.names =FALSE)# Inspect the datahead(penguins)
# Optional: save table as CSVwrite.csv( metrics_table,"classification_metrics_results.csv",row.names =FALSE)# ============================================================# TASK 4: THRESHOLD USE CASES# ============================================================cat("\nTHRESHOLD INTERPRETATION\n","\n0.2 threshold:\n","A lower threshold is useful when missing a true positive is costly.\n","Example: medical screening for a serious disease. The model can flag\n","more people for additional testing, accepting more false positives in\n","exchange for higher recall.\n","\n0.8 threshold:\n","A higher threshold is useful when false positives are costly.\n","Example: automatically approving a high-risk action only when the model\n","is very confident. Fewer observations are labeled positive, which tends\n","to increase precision but can miss some true positives.\n",sep ="")
THRESHOLD INTERPRETATION
0.2 threshold:
A lower threshold is useful when missing a true positive is costly.
Example: medical screening for a serious disease. The model can flag
more people for additional testing, accepting more false positives in
exchange for higher recall.
0.8 threshold:
A higher threshold is useful when false positives are costly.
Example: automatically approving a high-risk action only when the model
is very confident. Fewer observations are labeled positive, which tends
to increase precision but can miss some true positives.
# ============================================================# SHORT INTERPRETATION# ============================================================cat("\nINTERPRETATION\n","The null error rate shows the error we would get by always predicting\n","the majority class. A useful classification model should improve on\n","this simple baseline. Lowering the probability threshold predicts more\n","positive cases and usually increases recall. Raising the threshold makes\n","positive predictions more selective and usually increases precision.\n","Therefore, threshold choice should depend on the consequences of false\n","positives and false negatives.\n",sep ="")
INTERPRETATION
The null error rate shows the error we would get by always predicting
the majority class. A useful classification model should improve on
this simple baseline. Lowering the probability threshold predicts more
positive cases and usually increases recall. Raising the threshold makes
positive predictions more selective and usually increases precision.
Therefore, threshold choice should depend on the consequences of false
positives and false negatives.