Ejemplo n.º 1
2
    def create_non_homogeneus_cloud(self, symbolClasses):
        indicator = 1.0
        ratio = global_v.N_LEARNING/(global_v.N_LEARNING+global_v.N_TEST)
        for cl in symbolClasses:
            for i in range(0, int(indicator)):

                # instance of new symbol
                distortedClass = SymbolClass(cl.name, cl.color)
                # randomize position around a given class(based on position)
                distortedClass.characteristicsValues = self.__generate_distortion(
                                                                cl.characteristicsValues[:],
                                                                global_v.HOMO_STD_DEV)
                
                scope =  int((global_v.N_LEARNING + global_v.N_TEST)/int(indicator))   
                for j in range (0, scope):
                    cloud_point = SymbolClass(cl.name, cl.color)
                    cloud_point.characteristicsValues = self.__generate_distortion(
                                                                distortedClass.characteristicsValues[:], 
                                                                global_v.NON_HOMO_STD_DEV)
                    # store result
                    if(j < ratio * scope):
                        cl.learning_set.append(cloud_point)
                    else:
                        cl.test_set.append(cloud_point)
                    

            # Info about number of created points
            console.write_non_homo(cl.name, int(indicator), "Symbol Class", "Groups")
            console.write_point_text_number(">> Number of distorted classes per symbol", len(cl.learning_set) + len(cl.test_set))
            console.write_point_text_number(">> Number of learning set points", 
                                            len(cl.learning_set))
            console.write_point_text_number(">> Number of test set points", 
                                            len(cl.test_set))    
            indicator += 0.5
 def create_homogeneus_cloud(self, symbolClasses):
     for cl in symbolClasses:
         # Learning set
         for i in range(0, global_v.N_LEARNING + global_v.N_TEST):
             # instance of new symbol
             distortedClass = SymbolClass(cl.name, cl.color, type = SymbolType.NATIVE_LEARNING)
             # randomize position around a given class(based on position)
             distortedClass.characteristicsValues = self.__generate_distortion(
                                                             cl.characteristicsValues[:],
                                                             global_v.HOMO_STD_DEV)
             # store result
             if(i < global_v.N_LEARNING):
                 cl.learning_set.append(distortedClass)
             else:
                 cl.test_set.append(distortedClass)
         print(cl.name)
         console.write_point_text_number(">> Number of learning set points",
                             len(cl.learning_set))
         console.write_point_text_number(">> Number of test set points",
                                         len(cl.test_set))
Ejemplo n.º 3
0
 def create_homogeneus_cloud(self, symbolClasses):
     for cl in symbolClasses:
         # Learning set
         for i in range(0, global_v.N_LEARNING + global_v.N_TEST):
             # instance of new symbol
             distortedClass = SymbolClass(cl.name, cl.color, type = SymbolType.NATIVE_LEARNING)
             # randomize position around a given class(based on position)
             distortedClass.characteristicsValues = self.__generate_distortion(
                                                             cl.characteristicsValues[:],
                                                             global_v.HOMO_STD_DEV)
             # store result 
             if(i < global_v.N_LEARNING):
                 cl.learning_set.append(distortedClass)
             else:
                 cl.test_set.append(distortedClass)
         print(cl.name)        
         console.write_point_text_number(">> Number of learning set points", 
                             len(cl.learning_set))
         console.write_point_text_number(">> Number of test set points", 
                                         len(cl.test_set))    
    def create_non_homogeneus_cloud(self, symbolClasses):
        indicator = 1.0
        ratio = global_v.N_LEARNING/(global_v.N_LEARNING+global_v.N_TEST)
        for cl in symbolClasses:
            for i in range(0, int(indicator)):

                # instance of new symbol
                distortedClass = SymbolClass(cl.name, cl.color)
                # randomize position around a given class(based on position)
                distortedClass.characteristicsValues = self.__generate_distortion(
                                                                cl.characteristicsValues[:],
                                                                global_v.HOMO_STD_DEV)

                scope =  int((global_v.N_LEARNING + global_v.N_TEST)/int(indicator))
                for j in range (0, scope):
                    cloud_point = SymbolClass(cl.name, cl.color)
                    cloud_point.characteristicsValues = self.__generate_distortion(
                                                                distortedClass.characteristicsValues[:],
                                                                global_v.NON_HOMO_STD_DEV)
                    # store result
                    if(j < ratio * scope):
                        cl.learning_set.append(cloud_point)
                    else:
                        cl.test_set.append(cloud_point)


            # Info about number of created points
            console.write_non_homo(cl.name, int(indicator), "Symbol Class", "Groups")
            console.write_point_text_number(">> Number of distorted classes per symbol", len(cl.learning_set) + len(cl.test_set))
            console.write_point_text_number(">> Number of learning set points",
                                            len(cl.learning_set))
            console.write_point_text_number(">> Number of test set points",
                                            len(cl.test_set))
            indicator += 0.5