Created
January 10, 2015 12:13
-
-
Save badbye/1e2524362ab36f569784 to your computer and use it in GitHub Desktop.
coursera(machine learning: score)
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
getScore = function(checkBox = 0){ | |
result = c() | |
multi = 5 * checkBox | |
Single = 20 - checkBox | |
for (i in 0:Single){ | |
for (j in 0:multi){ | |
result = c(result, i, j, 20*i - 5*(Single-i) + j*4 - 4*(multi-j)) | |
} | |
} | |
result = matrix(result, ncol=3, byrow = T) | |
result = data.frame(result) | |
colnames(result) = c('single', 'multi', 'score') | |
result[order(result$score), ] | |
} | |
getScore(5) | |
findScore = function(box, Score){ | |
re = getScore(box) | |
subset(re, score == Score) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment