Skip to content

Commit

Permalink
Merge pull request benhamner#19 from eduardofv/master
Browse files Browse the repository at this point in the history
Validation for empty vectors
  • Loading branch information
benhamner committed Sep 9, 2015
2 parents cf45192 + 9479091 commit 9a637ae
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions R/R/metrics.r
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@ apk <- function(k, actual, predicted)
#' @export
mapk <- function (k, actual, predicted)
{
if( length(actual)==0 || length(predicted)==0 )
{
return(0.0)
}

scores <- rep(0, length(actual))
for (i in 1:length(scores))
{
Expand Down

0 comments on commit 9a637ae

Please sign in to comment.