Esempio n. 1
0
    def instance(source_uri, random_seed=0):
        relation_helper = RelationHelper(source_uri)
        private_manager = kernel.PrivateManager(relation_helper.filename,
                                                relation_helper.config,
                                                random_seed=random_seed)
        kernel_service = pservice.KernelService(private_manager)

        return ProtectedDataSource(kernel_service,
                                   DataManager(transformation.Null()))
Esempio n. 2
0
    def __init__(self,
                 source_uri,
                 data_config,
                 file_delimiter=',',
                 random_seed=0,
                 budget=1.0):
        self.source_uri = source_uri
        self.data_config = data_config
        self.file_delimiter = file_delimiter
        self.random_seed = random_seed
        self._budget = budget
        self.prng = np.random.RandomState(random_seed)
        self._data_manager = DataManager(transformation.Null())
        self._tgraph = TransformationGraph()
        self._data = None

        data_node = self._data_manager._dgraph.root
        self._tgraph.insert_transformation(data_node, transformation.Null())
Esempio n. 3
0
    def partition(self, operator, after):
        assert util.contains_superclass(operator.__class__, 'SplitByPartition')

        data_nodes = self._data_manager.partition(operator, self.prng,
                                                  after.data_node)
        meta_node = self._tgraph.insert_transformation(after.data_node,
                                                       operator, after)

        child_nodes = []
        for data_node in data_nodes:
            child_node = self._tgraph.insert_transformation(
                data_node, transformation.Null(), meta_node)
            child_nodes.append(child_node)

        return child_nodes
Esempio n. 4
0
    def __init__(self,
                 kernel_service,
                 data_manager=DataManager(transformation.Null()),
                 private_node_id=None,
                 data_node=None,
                 random_seed=None):
        self.kernel_service = kernel_service
        self.data_manager = data_manager
        self.prng = np.random.RandomState(random_seed)

        if private_node_id is not None:
            self.private_node_id = private_node_id
        else:
            self.private_node_id = self.kernel_service.get_root_id()

        if data_node is not None:
            self.data_node = data_node
        else:
            self.data_node = self.data_manager._dgraph.root