def full_test():
    # CREATE CHAR_NUM CHARACTERISTICS
    console.write_header("Creating Characteristics")
    characteristics = []
    data.generate_characteristic(characteristics)
    
    # CREATE CLASS_NUM SYMBOL CLASSES
    console.write_header(" Creating Symbol Classes")
    symbolClasses = []
    data.generate_symbol_classes(symbolClasses, characteristics)
    
    console.write_header("Computing Homogeneous Distortion")
    Distorter().create_homogeneus_cloud(symbolClasses)

    for c in range(0, util.global_variables.CLASS_NUM):
        console.write_header("Computing Cluster Evaluation")
        best_k = ps.cluster_evaluation(util.global_variables.MAX_K_CLUS_EVALUATION, symbolClasses[c:c+1])
        util.global_variables.K = best_k[0]
        console.write_header("Computing Clusters with K:", str(util.global_variables.K))
        Clusterer().computeClusters(symbolClasses[c:c+1])

    console.write_header("Creating Non Homogeneous Foreign")
    foreignClassesNonHomo = f_creator.create_non_homogeneous_foreign(symbolClasses)
    console.write_header("Creating Homogeneous Foreign")
    foreignClassesHomo = f_creator.create_homogeneous_foreign(symbolClasses, characteristics)
    console.write_header(" Synthetic Data Calculations")
    synth_calc.ambiguity_for_different_radiuses(symbolClasses[:], foreignClassesHomo, foreignClassesNonHomo)
def synthetic_test_paper_2():
    # CREATE CHAR_NUM CHARACTERISTICS
    console.write_header("Creating Characteristics")
    characteristics = []
    data.generate_characteristic(characteristics)

    # CREATE CLASS_NUM SYMBOL CLASSES
    console.write_header(" Creating Symbol Classes")
    symbolClasses = []
    data.generate_symbol_classes(symbolClasses, characteristics)

    # CREATE CLOUD DISTORTION IN NATIVE SET
    console.write_header("Computing K cloud Distortion")
    Distorter().create_cluster_assessment_cloud(util.global_variables.K_CLOUD_DISTORTION,symbolClasses)
    #Distorter().create_k_clouds(util.global_variables.K_CLOUD_DISTORTION,symbolClasses)

    util.global_variables.K = 2

    Clusterer().computeClusters(symbolClasses[:])
    Plot3D().renderPlot(symbolClasses)

    util.global_variables.K = 1

    Clusterer().computeClusters(symbolClasses[:])
    Plot3D().renderPlot(symbolClasses)

    util.global_variables.K = 3

    Clusterer().computeClusters(symbolClasses[:])
    Plot3D().renderPlot(symbolClasses)
def synthetic_homo_native():
    # CREATE CHAR_NUM CHARACTERISTICS
    console.write_header("Creating Characteristics")
    characteristics = []
    data.generate_characteristic(characteristics)
    
    # CREATE CLASS_NUM SYMBOL CLASSES
    console.write_header(" Creating Symbol Classes")
    symbolClasses = []
    data.generate_symbol_classes(symbolClasses, characteristics)
    
    # Distortion
    console.write_header("Computing Homogeneous Distortion")
    Distorter().create_homogeneus_cloud(symbolClasses)
    # Clustering
    console.write_header("Computing Clusters")
    Clusterer().computeClusters(symbolClasses[:util.global_variables.CLASS_NUM])
    # Plot3D
    console.write_header(" Displaying Plot")
    Plot3D().renderPlot(symbolClasses[:util.global_variables.CLASS_NUM])
    # Generating Foreign classes
    console.write_header("Creating Non Homogeneous Foreign")
    foreignClassesNonHomo = f_creator.create_non_homogeneous_foreign(symbolClasses)
    console.write_header("Creating Homogeneous Foreign")
    foreignClassesHomo = f_creator.create_homogeneous_foreign(symbolClasses, characteristics)
    # Radiuses 
    console.write_header(" Synthetic Data Calculations")
    synth_calc.ambiguity_for_different_radiuses(symbolClasses[:], foreignClassesHomo, foreignClassesNonHomo)
Example #4
0
def __generate_symbol():
    characteristics = []
    data.generate_characteristic(characteristics)

    symbolClasses = []
    data.generate_symbol_classes(symbolClasses, characteristics)

    Distorter().create_cluster_assessment_cloud(global_v.K_CLOUD_DISTORTION,
                                            symbolClasses)

    return symbolClasses
def grouping_assessment():
    # CREATE CHAR_NUM CHARACTERISTICS
    console.write_header("Creating Characteristics")
    characteristics = []
    data.generate_characteristic(characteristics)
    
    # CREATE CLASS_NUM SYMBOL CLASSES
    console.write_header(" Creating Symbol Classes")
    symbolClasses = []
    data.generate_symbol_classes(symbolClasses, characteristics)
    
    console.write_header("Computing K cloud Distortion")
    #Distorter().create_k_clouds(util.global_variables.K_CLOUD_DISTORTION,symbolClasses)
    Distorter().create_non_homogeneus_cloud(symbolClasses)
    console.write_header("Computing Cluster Evaluation")
    ps.cluster_evaluation(util.global_variables.MAX_K_CLUS_EVALUATION,symbolClasses)
def synthetic_test_paper_1():
    # CREATE CHAR_NUM CHARACTERISTICS
    console.write_header("Creating Characteristics")
    characteristics = []
    data.generate_characteristic(characteristics)
    
    # CREATE CLASS_NUM SYMBOL CLASSES
    console.write_header(" Creating Symbol Classes")
    symbolClasses = []
    data.generate_symbol_classes(symbolClasses, characteristics)

    # DISTORTION (UNIFORM)
    console.write_header("Computing Homogeneous Distortion")
    Distorter().create_homogeneus_cloud(symbolClasses)
    
    # FOREIGN HOMOGENEOUS
    console.write_header("Creating Homogeneous Foreign")
    foreignClassesHomo = f_creator.create_homogeneous_foreign(symbolClasses, characteristics)
    
    # FOREIGN NON-HOMOGENEOUS
    console.write_header("Creating Non Homogeneous Foreign")
    foreignClassesNonHomo = f_creator.create_non_homogeneous_foreign(symbolClasses)

    # CREATE ELLIPSOIDS AND CUBOIDS FOR EACH LEARNING SET
    console.write_header("Generating Convex and Compact Sets")
    membership = BasicMembership(symbolClasses)
    membership.shrink_objects(0)  # just to write to he file
        
    plot = Plot2D()
    plot.renderPlot(symbolClasses, membership, ObjectType.ELLIPSOID)
    plot.renderPlot(symbolClasses, membership, ObjectType.CUBOID)
    
    for i in range(0,5):
        # Check native
        membership.check_natives_ellipsoid_proper(symbolClasses[:],"foreign_homo","foreign_non_homo")
        membership.check_natives_cuboid_proper(symbolClasses[:],"foreign_homo","foreign_non_homo") 
        # Check foreign
        membership.check_foreign_ellipsoid(foreignClassesHomo,      "foreign_homo")
        membership.check_foreign_ellipsoid(foreignClassesNonHomo,   "foreign_non_homo")
        membership.check_foreign_cuboids(foreignClassesHomo,        "foreign_homo")
        membership.check_foreign_cuboids(foreignClassesNonHomo,     "foreign_non_homo")
        # Shrink
        if i != 4:
            membership.shrink_objects(5)
            plot.renderPlot(symbolClasses, membership, ObjectType.ELLIPSOID)
            plot.renderPlot(symbolClasses, membership, ObjectType.CUBOID)