Learn R Programming

tidysynthesis (version 0.1.2)

add_noise_gaussian: Add normal noise with mean 0 to predicted values with constant variance

Description

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

Usage

add_noise_gaussian(
  model,
  new_data,
  conf_model_data,
  outcome_var,
  col_schema,
  pred,
  variance = NULL,
  rho = 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

rho

Alternative privacy loss budget prescribed by the Gaussian mechanism under rho-zero-concentrated differential privacy.

sensitivity

Alternative sample sensitivity prescribed by the Gaussian mechanism under rho-zero-concentrated differential privacy.

Examples

Run this code

add_noise_gaussian(
  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