Ejemplo n.º 1
0
    def __init__(self, site, log_path, output_split_logs = False):
        assert site is not None
        assert isinstance(site, str)
        assert log_path is not None
        assert isinstance(log_path, str)

        self._initialized = False
        self._nodes = None

        nodelogs = _split_node_data(log_path, output_split_logs)

        nodes = {}
        for nodeid, log in nodelogs.items():
            print " * Loading data for node nr. %d ..." % nodeid
            assert not (nodeid in nodes.keys())
        
            node = Node(site, nodeid, log)

            if node.initialized():
                nodes[nodeid] = node
            else:
                print "warning: discarding data on node nr. %d since it failed to parse its log\n" % nodeid

        self._nodes = nodes
        self._initialized = True
Ejemplo n.º 2
0
    def __init__(self, site, log_path, N, barN, alpha_0, sigma, output_split_logs = False):
        assert site is not None
        assert isinstance(site, str)
        assert log_path is not None
        assert isinstance(log_path, str)

        nodelogs = self._split_node_data(log_path, output_split_logs)

        self._initialized = False

        nodes = {}
        for nodeid, log in nodelogs.items():
            print " * Loading data for node nr. %d ..." % nodeid
            assert not (nodeid in nodes.keys())
        
            node = Node(site, nodeid, log, N, barN, alpha_0, sigma)

            if node.initialized():
                nodes[nodeid] = node
            else:
                print "warning: discarding data on node nr. %d since it failed to parse its log\n" % nodeid


        if len(nodes.keys()) == 0:
            print "No valid data loaded."
            return
    
        self._log_path = log_path
        self._epoch = 0
        self._M = nodes.values()[0].get_M()
        self._D = nodes.values()[0].get_D()
        self._N = N
        self._barN = barN
        self._alpha_0 = alpha_0
        self._sigma = sigma
        self._nodes = nodes

        self._initialized = True

        print "ChangeDetection network initialized with N=%d, barN=%d, alpha0=%.3f, sigma=%.3f" % (N, barN, alpha_0, sigma)
        self.print_info()