- Using the Laplace mechanism
- Dataset adult.csv
Note:[Column Name]
refers to replacing it with the actual column name.
-
([Column Name]:[Value])
-
Example:
(age:30)
means comparingage
with30
{[Comparison Operator]:[Pairwise Comparison]}
Symbol | Operators |
---|---|
$gt |
> |
$lt |
< |
$eq |
= |
Note: Other operators can use the above comparison operators and the not operator below for inference.
- Example:
{$gt:(age:30)}
is equivalent toage>30
{[Logical Operators]:[[Sub-Operator],..]}
Symbol | Operator | Number of Sub-Operators |
---|---|---|
$and |
and | 2 |
$or |
or | 2 |
$not |
not | 1 |
-
Example 1:
{$and:[{$gt:(age:30)},{$lt:(age:50)}]}
is equivalent toage>30
andage<50
-
Example 2:
{$not:[{$gt:(age:30)}]}
is equivalent toage<=30
-
Example 3
{
$or:[
{$gt:(age:30)},
{$and:[
{$lt:(age:20)},
{$not:[
{$eq:(workclass:Private)}
]}
]
]
}
Equivalent to:
(age>30) or (age<20 and not workclass==Private)
[Column].[Query Type]([Operator])
- Example:
age.mean({$eq:(workclass:Private)})
returns the averageage
of records withwordclass
asPrivate
Note: If the Operator is left blank, the result will compute on the entire dataset.
min
: minimum valuemax
: maximum valuemean
: meancount
: countmedian
: mediansum
: sumvariance
: variancemode
: mode
Note: For numeric queries, the column data must be numeric.
Use pip to install the necessary packages.
pip install -r requirements.txt
Use python to run the program.
python main.py
For change requests, please contact me and discuss the issue with me.