add_noise_laplace: Add Laplace noise with mean 0 to predicted values with...

View source: R/add_noise_laplace.R

add_noise_laplaceR Documentation

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
)

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.

Value

A numeric vector with noise added to each prediction

Examples


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


tidysynthesis documentation built on March 17, 2026, 1:06 a.m.