-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #775 from gjwgit/zy/760_evaluate_rpart_hand
zy/760 EVALUATE: rpart hand as the template for other methods
- Loading branch information
Showing
23 changed files
with
209 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,60 @@ | ||
# PLACE HOLDER FOR NOW - THE CODE CAME FROM evaluate_model_rpart.R | ||
# Use `actual` and `probability` for David Hand's classifier evaluation. | ||
# | ||
# Copyright (C) 2025, Togaware Pty Ltd. | ||
# | ||
# License: GNU General Public License, Version 3 (the "License") | ||
# https://www.gnu.org/licenses/gpl-3.0.en.html | ||
# | ||
# Time-stamp: <Friday 2025-01-10 16:03:40 +1100 Graham Williams> | ||
# | ||
# Licensed under the GNU General Public License, Version 3 (the "License"); | ||
# | ||
# This program is free software: you can redistribute it and/or modify it under | ||
# the terms of the GNU General Public License as published by the Free Software | ||
# Foundation, either version 3 of the License, or (at your option) any later | ||
# version. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
# details. | ||
# | ||
# You should have received a copy of the GNU General Public License along with | ||
# this program. If not, see <https://www.gnu.org/licenses/>. | ||
# | ||
# Author: Zheyuan Xu, Graham Williams | ||
|
||
# TIMESTAMP | ||
# | ||
# References: | ||
# | ||
# @williams:2017:essentials Chapter 7. | ||
# https://survivor.togaware.com/datascience/ for further details. | ||
|
||
# Load required packages from the local library into the R session. | ||
|
||
library(glue) | ||
library(hmeasure) # David Hand's classifier performance measure. | ||
|
||
# Evaluate the model using HMeasure. | ||
|
||
results <- HMeasure(true.class = actual_rpart_labels, scores = predicted_rpart_probs) | ||
results <- hmeasure::HMeasure(true.class = actual, scores = probability) | ||
|
||
# Create a single SVG file that displays all 4 plots. | ||
|
||
svg(filename = glue("TEMPDIR/model_evaluate_hand_{mtype}_{dtype}.svg"), | ||
width = 11, | ||
height = 8) | ||
|
||
# Set up a 2x2 layout. | ||
|
||
par(mfrow = c(2, 2)) | ||
|
||
svg("TEMPDIR/model_rpart_evaluate_hand.svg") | ||
# Generate the four plots in one device. | ||
|
||
plotROC(results) | ||
hmeasure::plotROC(results, which = 1,) | ||
hmeasure::plotROC(results, which = 2,) | ||
hmeasure::plotROC(results, which = 3,) | ||
hmeasure::plotROC(results, which = 4,) | ||
|
||
dev.off() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.