Esempio n. 1
0
    def get_parameters(self):
        """
        This function creates some parameters to be used with DBScan.
        @return: A tuple with the generated parameters and an empty list corresponding to the clusterings.
        """
        run_parameters = []

        # (minpts, eps tuples)
        if "max" in self.parameters["clustering"]["algorithms"]["dbscan"]:
            max_eps_tries = self.parameters["clustering"]["algorithms"]["dbscan"]["max"]
        else:
            max_eps_tries = 10

        num_elements = self.distance_matrix.row_length
        klist = k_scale_gen(math.log(num_elements))
        buffer = numpy.empty(num_elements)
        kdist_matrix = k_dist(klist, buffer, self.distance_matrix)

        dbscan_param_pairs = dbscanTools.dbscan_param_space_search(self.parameters["clustering"]["evaluation"]["maximum_noise"],
                                                                   max_eps_tries,
                                                                   num_elements,
                                                                   klist,
                                                                   kdist_matrix) +\
                            zhou_adaptative_determination(kdist_matrix, self.distance_matrix)

        for (minpts, eps) in dbscan_param_pairs:
            run_parameter = ParametersGenerator.get_base_parameters()
            run_parameter["minpts"] = minpts
            run_parameter["eps"] = eps
            run_parameters.append(run_parameter)

        return run_parameters, []
Esempio n. 2
0
 def test_k_scale_gen(self):
     self.assertItemsEqual(k_scale_gen(100), [2, 4, 8, 16, 32, 64, 128])
     self.assertItemsEqual(k_scale_gen(7), [2, 4, 8])
     self.assertItemsEqual(k_scale_gen(0), [])
Esempio n. 3
0
 def test_k_scale_gen(self):
     self.assertItemsEqual( k_scale_gen(100),    [2, 4, 8, 16, 32, 64,128])
     self.assertItemsEqual( k_scale_gen(7),      [2, 4, 8])
     self.assertItemsEqual( k_scale_gen(0),      [])