Learn R Programming

tidysynthesis (version 0.1.2)

add_noise_laplace: Add Laplace noise with mean 0 to predicted values with constant variance

Description

Add Laplace noise with mean 0 to predicted values with constant variance

Usage

add_noise_laplace(
  model,
  new_data,
  conf_model_data,
  outcome_var,
  col_schema,
  pred,
  variance = NULL,
  epsilon = NULL,
  sensitivity = NULL
)

Value

A numeric vector with noise added to each prediction

Arguments

model

A model_spec or a list of model_specs from library(parsnip)

new_data

A data frame used to generate predictions

conf_model_data

A data frame for estimating the predictive model

outcome_var

A string name representing the outcome variable

col_schema

A list of column schema specifications for the new variable

pred

A vector of values predicted by the model

variance

Sampling variance for additive noise

epsilon

Alternative privacy loss budget prescribed by the Laplace mechanism under epsilon differential privacy.

sensitivity

Alternative sample sensitivity prescribed by the Laplace mechanism under epsilon differential privacy.

Examples

Run this code

add_noise_laplace(
  model = NULL,
  new_data = NULL,
  conf_model_data = NULL,
  outcome_var = NULL,
  col_schema = NULL,
  pred = 1:100,
  variance = 3
)

Run the code above in your browser using DataLab