In [3]: # Load the data and Libraries import pandas as pd import numpy as np...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
In [3]: # Load the data and Libraries import pandas as pd import numpy as np from scipy import stats import matplotlib.pyplot as plt plt.style.use('seaborn-whitegrid') def laplace_mech (v, sensitivity, epsilon): return v + np.random.laplace(loc=0, scale=sensitivity / epsilon) def laplace_mech_vec(qs, sensitivity, epsilon): return [laplace_mech(q, sensitivity, epsilon) for q in qs] def gaussian_mech(v, sensitivity, epsilon, delta): return v + np.random.normal(loc=0, scale-sensitivity * np.sqrt(2*np.log(1.25/delta)) / epsilon) def gaussian_mech_vec(qs, sensitivity, epsilon, delta): return [gaussian_mech(q, sensitivity, epsilon, delta) for q in qs] def pct_error (orig, priv): return np.abs(orig - priv)/orig * 100.0 adult = pd.read_csv( 'https://github.com/jnear/cs211-data-privacy/raw/master/homework/adult_with_pii.csv') In [ ]: In [ ]: Consider the code below, which defines three average queries and runs them on adult_data, using the Laplace mechanism to provide differential privacy with € 1 for each query. b_capgain = 10000 b_age = 3000 epsilon 1 def query1(): return np. sum (adult['Capital Gain'].clip(lower=0, upper=b_capgain)) def query2(): return len(adult[adult['Education-Num'] < 10]) def query3(): return np.sum(adult['Age'].clip (lower=0, upper=b_age)) def my_query(): return [query1(), query2(), query()] my_query() def dp_my_query(epsilon): # YOUR CODE HERE raise Not ImplementedError() dp_my_query(1.0) In 2-5 sentences, answer the following: • What is the L₁ global sensitivity of my_query, and why? • What is the L2 global sensitivity of my_query, and why? YOUR ANSWER HERE In [3]: # Load the data and Libraries import pandas as pd import numpy as np from scipy import stats import matplotlib.pyplot as plt plt.style.use('seaborn-whitegrid') def laplace_mech (v, sensitivity, epsilon): return v + np.random.laplace(loc=0, scale=sensitivity / epsilon) def laplace_mech_vec(qs, sensitivity, epsilon): return [laplace_mech(q, sensitivity, epsilon) for q in qs] def gaussian_mech(v, sensitivity, epsilon, delta): return v + np.random.normal(loc=0, scale-sensitivity * np.sqrt(2*np.log(1.25/delta)) / epsilon) def gaussian_mech_vec(qs, sensitivity, epsilon, delta): return [gaussian_mech(q, sensitivity, epsilon, delta) for q in qs] def pct_error (orig, priv): return np.abs(orig - priv)/orig * 100.0 adult = pd.read_csv( 'https://github.com/jnear/cs211-data-privacy/raw/master/homework/adult_with_pii.csv') In [ ]: In [ ]: Consider the code below, which defines three average queries and runs them on adult_data, using the Laplace mechanism to provide differential privacy with € 1 for each query. b_capgain = 10000 b_age = 3000 epsilon 1 def query1(): return np. sum (adult['Capital Gain'].clip(lower=0, upper=b_capgain)) def query2(): return len(adult[adult['Education-Num'] < 10]) def query3(): return np.sum(adult['Age'].clip (lower=0, upper=b_age)) def my_query(): return [query1(), query2(), query()] my_query() def dp_my_query(epsilon): # YOUR CODE HERE raise Not ImplementedError() dp_my_query(1.0) In 2-5 sentences, answer the following: • What is the L₁ global sensitivity of my_query, and why? • What is the L2 global sensitivity of my_query, and why? YOUR ANSWER HERE
Expert Answer:
Answer rating: 100% (QA)
The L1 global sensitivity of my query is 10000 3000 10000 53000 This is because the L1 global sensit... View the full answer
Related Book For
Analytics Data Science And Artificial Intelligence Systems For Decision Support
ISBN: 9781292341552
11th Global Edition
Authors: Ramesh Sharda, Dursun Delen, Efraim Turban
Posted Date:
Students also viewed these programming questions
-
2. For Z-ordering curve, with 16 16 pixels (or cells), please use the bit-shuffling method to find the mappings between cell locations and Z-values below. [20 points] 2a. Please illustrate how to...
-
You've just received your new Scooty-Puff, Jr. Space scooter in the mail and you hope to use it to travel from Earth to Mars. The specification sheet that came with it says that it will provide a...
-
Why do you think there should be equitable distribution of resources ? What forces would be working against an equitable distribution of our resources ?
-
Starting one month from now, you need to withdraw $210 per month from your bank account to help cover the costs of your university education. You will continue the monthly withdrawals for the next...
-
(a) Of an infinite plane carrying a current of linear density i; the vector i is the same at all points of the plane; (b) Of two parallel infinite planes carrying currents of linear densities i and ...
-
Iterating Over a Collection Iterating a method over a collection of objects is a common task that you may complete unknowingly each day. Within a collection of similar things, you identify the...
-
Discuss the purpose and various titles of the Patient Protection and Affordable Care Act of 2010 (PPACA).
-
WallsFarther Bank has the following balance sheet (in millions of dollars): Cash inflows over the next 30 days from the FI's performing assets are $ 5.5 million. Calculate the LCR for WallsFarther...
-
Could you List and fully explain four essential attributes of well engineered software systems?
-
Consider the Income Statement and Note 18 (Supplemental information) for General Mills below and answer the following questions. Assume revenue is presented gross of bad debt expense. a. Assume that...
-
The total cost function of the dominant firm is CT = 80qp and the function of the offer of the following companies is represented by P = 100 + 0.51qs A) Calculate the selling price, the output of the...
-
During the euro-area crisis, interest rate spreads between the sovereign debt of peripheral countries and Germany widened most sharply when it was feared that one or more countries might leave the...
-
Barbara J. Krumsiek of the Calvert Group recently talked about the style of meetings that take place in her organization: I think it can be a little jar ring actually for people who are used to...
-
The FOMCs success in meeting its objectives is enhanced by: a. Its independence, which comes from its members long terms, budgetary autonomy, and the irreversibility of its policy decisions. b. Clear...
-
A. Compare Bryans less effective and more effective messages giving directions for how to arrange company travel. Identify the ways in which he improved the message. B. How do you think the more...
-
Assume the role of Latisha. Write a proposal to develop a stress management program. Use well-justified logic to support your conclusions and recommendations. When Jeff arrived back at the office, he...
-
which or the following is least like the others: a. science b.humility c. confirmation bias d. tolerance for ambiguity
-
General Electric Capital, a division of General Electric, uses long-term debt extensively. In a recent year, GE Capital issued $11 billion in long-term debt to investors, then within days filed legal...
-
In 2018, 526 companies from around the world took part in the four-day World Internet of Things Exhibition in Wuxi, China. Read and discuss the article on thisexpo at...
-
Recent news about illegal intervention in elections has led to the discussion about who is responsible for damage control. When chatbots and automated social media systems have the ability to...
-
Describe how collaborating robotics can be used in manufacturing.
-
True or False: Inflation decreases the purchasing power of money.
-
Logan is conducting an economic evaluation under inflation using the then-current approach. If the inflation rate is \(j\) and the real time value of money rate is \(d\), which of the following is...
-
What is a good working definition of inflation in 10 words or less?
Study smarter with the SolutionInn App