Question: Based on code below (in python) def laplace_mech_vec(qs, sensitivity, epsilon) : return qs + np. random . laplace(loc=0, scale=sensitivity / epsilon, size=qs . shape) Question

Based on code below (in python)

Based on code below (in python) def laplace_mech_vec(qs, sensitivity, epsilon) : returnqs + np. random . laplace(loc=0, scale=sensitivity / epsilon, size=qs . shape)Question 20 (3 points) In the cell below, define a function that

def laplace_mech_vec(qs, sensitivity, epsilon) : return qs + np. random . laplace(loc=0, scale=sensitivity / epsilon, size=qs . shape) Question 20 (3 points) In the cell below, define a function that implements the vector version of the Gaussian mechanism. def gaussian_mech_vec(qs, sensitivity, epsilon, delta): mean =0 sigma = np. sqrt(2*np. log(1. 25/delta) )*((sensitivity/epsilon)**2) return qs + np . random. normal(loc=mean, scale=sigma, size=qs . shape) Question 21 (4 points) Consider the code below, which defines three average queries and runs them on adult_data . b_capgain = 3000 b_year = 3000 b_age = 3000 epsilon = 1 n = len(adult_data) def query1( ) : return np . sum(z_clip(adult_data[ 'Capital Gain'], b_capgain) ) def query2( ) : return np. sum(z_clip(adult_data[ 'DOB' ]. dt . year, b_year) ) def query3( ) : return np. sum(z_clip(adult_data['Age' ], b_age) ) def my_query ( ) : return [query1( ), query2(), query3( ) ] my_query ( )In the cell below, write code to release the results of calling my_query() with differential privacy. without using sequential composition. Hint\". use laplace_mech_uec , but be careful of sensitivity! your'_code_here() \f

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!