You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
254 lines
9.7 KiB
Python
254 lines
9.7 KiB
Python
6 years ago
|
"""
|
||
|
Health Information Privacy Lab
|
||
6 years ago
|
@TODO:
|
||
6 years ago
|
#
|
||
6 years ago
|
#
|
||
|
# At this point we have both columns for either sample,population or both
|
||
|
#
|
||
|
r['field count'] = len(cols)
|
||
|
return pd.DataFrame([r])
|
||
|
|
||
|
class Risk :
|
||
|
"""
|
||
|
This class is an abstraction of how we chose to structure risk computation i.e in 2 sub classes:
|
||
|
- Sample computes risk associated with a sample dataset only
|
||
|
- Population computes risk associated with a population
|
||
|
"""
|
||
|
def __init__(self):
|
||
|
self.cache = {}
|
||
|
def set(self,key,value):
|
||
|
if id not in self.cache :
|
||
|
self.cache[id] = {}
|
||
|
self.cache[key] = value
|
||
|
|
||
|
class Sample(Risk):
|
||
|
"""
|
||
|
This class will compute risk for the sample dataset: the marketer and prosecutor risk are computed by default.
|
||
|
This class can optionally add pitman risk if the population size is known.
|
||
|
"""
|
||
|
def __init__(self):
|
||
|
Risk.__init__(self)
|
||
|
def marketer(self):
|