コード例 #1
0
    def __init__(self, width, height, dataset, iteration_num=1000):
        self.radius = max(width, height) / 2.0
        self.time_constant = iteration_num / math.log10(self.radius)
        self.learning_rate = 0.09  #TODO to determine the init learning rate
        self.current_learning_rate = 0.0
        self.iteration_num = iteration_num
        self.current_iteration = 1
        self.neighbour_radius = 0.0

        self.width = width
        self.height = height
        self.nodes = []
        self.bmu = None
        self.mh = mahalanobis_helper(
            dataset)  # using given samples to calculate covariance matrix

        self.init_map_node(dataset)
        '''for x in range(self.width):
            for y in range(self.height):
                wv = [] # init weights vector for map node
                #wv.append(random.randint(*self.app_index_range))
                wv.append(random.randint(*self.duration_range))
                wv.append(random.randint(*self.num_events_range))
                wv.append(random.randint(*self.num_sys_objs_range))
                wv.append(random.randint(*self.token_index_range))
                wv.append(random.randint(*self.num_db_range))
                wv.append(random.randint(*self.num_cp_range))
                wv.append(random.randint(*self.num_network_range))
                # init new node and append to map
                self.nodes.append(Node(self, x, y, wv))'''

        # init the first round parameters
        self.update_neighbour_radius()
        self.update_learning_rate()
コード例 #2
0
    def __init__(self, width, height, dataset, iteration_num = 50):
        self.radius = max(width, height) / 2.0
        self.time_constant = iteration_num / math.log10(self.radius)
        self.learning_rate = 2.0 #TODO to determine the init learning rate
        self.current_learning_rate = 0.0
        self.iteration_num = iteration_num
        self.current_iteration = 1
        self.neighbour_radius = 0.0

        self.width = width
        self.height = height
        self.nodes = []
        self.bmu = None
        self.mh = mahalanobis_helper(dataset) # using given samples to calculate covariance matrix

        self.init_map_node(dataset)
        for x in range(self.width):
            for y in range(self.height):
                wv = [] # init weights vector for map node
                wv.append(random.randint(*self.obj_range))
                wv.append(random.randint(*self.pid_range))
                wv.append(random.randint(*self.date_range))
                wv.append(random.randint(*self.obj_occur_range))
                wv.append(random.randint(*self.pid_occur_range))
                self.nodes.append(Node(self, x, y, wv))
                
        # init the first round parameters
        self.update_neighbour_radius()
        self.update_learning_rate()
コード例 #3
0
    def __init__(self, width, height, dataset, iteration_num = 1000):
        self.radius = max(width, height) / 2.0
        self.time_constant = iteration_num / math.log10(self.radius)
        self.learning_rate = 0.09 #TODO to determine the init learning rate
        self.current_learning_rate = 0.0
        self.iteration_num = iteration_num
        self.current_iteration = 1
        self.neighbour_radius = 0.0

        self.width = width
        self.height = height
        self.nodes = []
        self.bmu = None
        self.mh = mahalanobis_helper(dataset) # using given samples to calculate covariance matrix

        self.init_map_node(dataset)
        '''for x in range(self.width):
            for y in range(self.height):
                wv = [] # init weights vector for map node
                #wv.append(random.randint(*self.app_index_range))
                wv.append(random.randint(*self.duration_range))
                wv.append(random.randint(*self.num_events_range))
                wv.append(random.randint(*self.num_sys_objs_range))
                wv.append(random.randint(*self.token_index_range))
                wv.append(random.randint(*self.num_db_range))
                wv.append(random.randint(*self.num_cp_range))
                wv.append(random.randint(*self.num_network_range))
                # init new node and append to map
                self.nodes.append(Node(self, x, y, wv))'''

        # init the first round parameters
        self.update_neighbour_radius()
        self.update_learning_rate()