This file contains hidden or 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
library(stringr) | |
solve <- function(code) { | |
# Extract the num | |
nums <- as.numeric(strsplit(gsub("[A-Z]", "", code), '')[[1]]) | |
letters <- unique(strsplit(gsub("[0-9]", "", code), "")[[1]]) | |
miss_nums <- setdiff(seq(1, 9), nums) | |
# Generate all permutations of possible solution numbers | |
# No permutation function in R so make my own |
This file contains hidden or 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
""" | |
MAUCpy | |
~~~~~~ | |
Contains two equations from Hand and Till's 2001 paper on a multi-class | |
approach to the AUC. The a_value() function is the probabilistic approximation | |
of the AUC found in equation 3, while MAUC() is the pairwise averaging of this | |
value for each of the classes. This is equation 7 in their paper. | |
""" |
This file contains hidden or 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
library(reshape2) | |
formattedtable <- function(x, block, group, value) { | |
# Form a dataframe with the mean values and get a logical matrix of the max values | |
mean <- setNames(aggregate(x[, value], list(x[, block], x[, group]), mean), c(block, group, "mean")) | |
# To get the max values need in wide format | |
mean.wide <- dcast(mean, get(block) ~ get(group), value.var="mean") # get() comes from reshape2, gets string values from variables | |
colnames(mean.wide)[1] <- block |