示例#1
0
    def __init__(self, short_name="GreedyH"):

        self.init_params = util.init_params_from_locals(locals())
        self._max_block_size = None
        self._partition_engine = None
        self._estimate_engine = greedyH.greedyH_engine()
        self.short_name = short_name
示例#2
0
    def __init__(self, c = 10,gz=0,short_name ="UGrid"):
        # c is the constant parameter controling the number of cells

        self.init_params = util.init_params_from_locals(locals())
        self.c = c
        self.gz= gz
        self.short_name = short_name
示例#3
0
    def __init__(self, index = 'DEFAULT1D', short_name = 'AHP*'):
        self.init_params = util.init_params_from_locals(locals())

        self._vSEP = Lfunction[index]['vSEP']
        self._vRatio = Lfunction[index]['vRatio']
        self._vEta = Lfunction[index]['vEta']
        self.short_name = short_name
示例#4
0
    def __init__(self,
                 shape_list,
                 domain_shape,
                 size,
                 seed=9001,
                 pretty_name='random range'):
        self.init_params = util.init_params_from_locals(locals())

        self.shape_list = copy.deepcopy(shape_list)
        self.seed = seed
        self.pretty_name = pretty_name
        self._size = size

        prng = numpy.random.RandomState(seed)
        if shape_list == None:
            shapes = randomQueryShapes(domain_shape, prng)
        else:
            prng.shuffle(self.shape_list)
            shapes = itertools.cycle(
                self.shape_list)  # infinite iterable over shapes in shape_list
        queries = []
        for i in range(size):
            lb, ub = placeRandomly(next(shapes), domain_shape,
                                   prng)  # seed must be None or repeats
            queries.append(ndRangeUnion().addRange(lb, ub, 1.0))
        super(RandomRange, self).__init__(queries, domain_shape)
示例#5
0
    def __init__(self, gz=11, alpha=0.5, short_name="DPCube"):
        # gz control the grid size for partition, alpha is the ratio of budget split for computing partition points
        self.init_params = util.init_params_from_locals(locals())

        self.gz = gz
        self.alpha = alpha
        self.short_name = short_name
示例#6
0
 def __init__(self, index = 'DEFALUT1D',ratio = 0.5, updateround = 100, short_name = 'MWEM*'):
     self.init_params = util.init_params_from_locals(locals())
     self._vSEP = Lfunction[index][0]
     self._vRound = Lfunction[index][1]
     self._updateround = updateround
     self._ratio = ratio
     self.short_name = short_name
示例#7
0
    def __init__(self, E):
        # move this to the highest subclass
        self.init_params = util.init_params_from_locals(locals())

        self.E = E
        self.X = self.E.X
        self.X_hat = None
        self.W = self.E.W
示例#8
0
    def __init__(self, ratio=0.25, short_name='DAWA'):
        # set ratio to 0 if no partition needed => GREEDYH_LINEAR,else DAWA_LINEAR.
        self.init_params = util.init_params_from_locals(locals())

        self._ratio = ratio
        self._partition_engine = l1partition.l1partition_approx_engine()
        self._estimate_engine = greedyH.greedyH_engine()
        self.short_name = short_name
示例#9
0
    def __init__(self, nickname, sample_to_scale, reduce_to_dom_shape=None, seed=None):
        self.init_params = util.init_params_from_locals(locals())

        self.fname = nickname
        assert nickname in filenameDict, 'Filename parameter not recognized: %s' % nickname
        hist = load(filenameDict[self.fname])
        dist = util.old_div(hist, float(hist.sum()))
        super(DatasetSampledFromFile,self).__init__(dist, sample_to_scale, reduce_to_dom_shape, seed)
示例#10
0
    def __init__(self, domain_shape, weight=1.0, pretty_name='identity'):
        self.init_params = util.init_params_from_locals(locals())
        self.weight = weight
        self.pretty_name = pretty_name

        indexes = itertools.product(*[list(range(i)) for i in domain_shape
                                      ])  # generate index tuples
        queries = [ndRangeUnion().addRange(i, i, weight) for i in indexes]
        super(self.__class__, self).__init__(queries, domain_shape)
示例#11
0
    def __init__(self, c=10, c2=5, alpha=0.5, short_name='AGrid'):
        # c,c2 are the constant parameter controling the number of cells in each level
        # alpha is the ratio of budget split on the first level
        self.init_params = util.init_params_from_locals(locals())

        self.c = c
        self.c2 = c2
        self.alpha = alpha
        self.short_name = short_name
示例#12
0
    def __init__(self, domain_shape_int, pretty_name='prefix 1D'):
        self.init_params = util.init_params_from_locals(locals())

        self.pretty_name = pretty_name

        queries = [
            ndRangeUnion().add1DRange(0, c, 1.0)
            for c in range(domain_shape_int)
        ]
        super(self.__class__, self).__init__(queries, (domain_shape_int, ))
示例#13
0
    def __init__(self, branch=2, granu=100):
        """Setup the branching factor and granularity in numerical search.
        
        branch(2) - the branching factor of the hierarchy
        granu(100) - the granularity in numerical search
        """
        self.init_params = util.init_params_from_locals(locals())

        self._branch = branch
        self._granu = granu
示例#14
0
    def __init__(self, ratio=0.5, max_block_size=None, short_name="DAWA"):
        """ c,c2 are the constant parameter controlling the number of cells in each level
         alpha is the ratio of budget split on the first level beside total budget"""
        self.init_params = util.init_params_from_locals(locals())

        self._ratio = ratio
        self._max_block_size = max_block_size
        self._partition_engine = l1partition.l1partition_approx_engine()

        self._estimate_engine = greedyH.greedyH_engine()
        self.short_name = short_name
示例#15
0
    def __init__(self, X, W, A, epsilon, seed=None):
        self.init_params = util.init_params_from_locals(locals())

        self.X = X
        self.W = W
        self.A = A
        self.epsilon = epsilon
        self.seed = seed

        self.X_hat = None
        self.state_op_log = None
示例#16
0
    def __init__(self, nrounds = 10, ratio = 0.5, updateround = 100,short_name ='MWEM'):
        """Set up parameters for MWEM.

        nrounds(10) - how many rounds are MWEM run.
        ratio(0.5) - the ratio of privacy budget used for query selection.
        updateround(100) - the number of iterations in each update.
        """
        self.init_params = util.init_params_from_locals(locals())
        
        self._updateround = updateround
        super(type(self), self).__init__(nrounds, ratio)
        self.short_name = short_name
示例#17
0
 def __init__(self, short_name='operator'):
     self.init_params = util.init_params_from_locals(locals())
     self.short_name = short_name
示例#18
0
 def __init__(self, short_name="QuadTree"):
     self.init_params = util.init_params_from_locals(locals())
     self.short_name = short_name
示例#19
0
 def __init__(self, short_name="Privelet"):
     self.init_params = util.init_params_from_locals(locals())
     self.short_name = short_name
示例#20
0
 def __init__(self,short_name="hierarchical_complete"):
     self.init_params = util.init_params_from_locals(locals())
     self.short_name = short_name
示例#21
0
 def __init__(self, foo, bar, short_name='my alg'):
     self.init_params = util.init_params_from_locals(locals())
     self.short_name = short_name
示例#22
0
    def __init__(self, br=0, short_name="HB"):
        #b control the branching, if b == 0, compute it based on expression in the paper

        self.init_params = util.init_params_from_locals(locals())
        self.br = br
        self.short_name = short_name
示例#23
0
 def __init__(self, ratio=0.85, eta=0.35, short_name = 'AHP'):
     self.init_params = util.init_params_from_locals(locals())
     self._ratio = ratio
     self._eta = eta 
     self.short_name = short_name
示例#24
0
 def __init__(self, short_name='Identity'):
     self.init_params = util.init_params_from_locals(locals())
     self.short_name = short_name
示例#25
0
 def __init__(self):
     self.init_params = util.init_params_from_locals(locals())
示例#26
0
 def __init__(self, short_name="Uniform"):
     self.init_params = util.init_params_from_locals(locals())
     self.short_name = short_name