Skip to content

Commit

Permalink
Change the return statement of bootstrap.replication to return the me…
Browse files Browse the repository at this point in the history
…an of the partition means (instead of the sum)
  • Loading branch information
MeganFantes committed Jun 7, 2019
1 parent 5845582 commit 32d61d5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions R/mechanism-bootstrap.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ bootstrap.replication <- function(x, n, sensitivity, epsilon, fun, inputObject,
stat.partitions[[i]] <- currentPartition * stat.currentPartition + noise.currentPartition
}
stat.out <- do.call(rbind, stat.partitions)
return(apply(stat.out, 2, sum))
# return(apply(stat.out, 2, sum))
# returnedBootstrappedResult = apply(stat.out, 2, sum)
returnedBootstrappedResult = apply(X = stat.out, MARGIN = 2, FUN = fun)
return(returnedBootstrappedResult)
}

# 2: treat it as a partition with a mean of 0 and keep it in the calculation, adding noise and adding it to the final calculation
Expand All @@ -52,7 +55,7 @@ bootstrap.replication <- function(x, n, sensitivity, epsilon, fun, inputObject,
# for (i in 1:max.appearances) {
# variance.i <- (i * probs[i] * (sensitivity^2)) / (2 * epsilon)
# if (i %in% validPartitions) {
# stat.i <- fun(x[partition == i])
# stat.i <- inputObject$bootStatEval(x[partition == currentPartition], fun, ...)
# noise.i <- dpNoise(n=length(stat.i), scale=sqrt(variance.i), dist='gaussian')
# stat.partitions[[i]] <- i * stat.i + noise.i
# } else {
Expand Down

1 comment on commit 32d61d5

@MeganFantes
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is part of resolving Issue #49

Please sign in to comment.