def __main__():

    matrix = [[0.7, 0.9, 0.4, 0.6, 1], [0.6, 0.9, 0.3, 0.7, 1],
              [0.6, 0.8, 0.3, 0.5, 1], [0.3, 0.5, 0.7, 0.2, 1],
              [0.3, 0.4, 0.8, 0.3, 1], [0.4, 0.5, 0.6, 0.3, 1],
              [0.9, 0.4, 0.5, 0.9, 0], [0.8, 0.5, 0.4, 0.8, 0],
              [0.2, 0.6, 0.7, 1.0, 0], [0.1, 0.7, 0.8, 0.8, 0]]

    instance_selection_obj = InstanceSelection(matrix)
    instance_selection_obj.apply()
    feature_selection_obj = FeatureSelection(
        instance_selection_obj.representative_instances_list[0])
    feature_selection_obj.apply(instance_selection_obj)
    print(instance_selection_obj.representative_instances_list)
    print(feature_selection_obj.rep_feature_set)
Ejemplo n.º 2
0
for size in range(MAX_ITERATIONS-1,MAX_ITERATIONS):
    np.random.shuffle(data)
    test_data = data[:size]

    #Representative Instance Selection
    start_time1 = time.time()
    InstanceSelector = InstanceSelection(test_data)
    InstanceSelector.apply()
    end_time1 = time.time()
    algo1_time = end_time1-start_time1

    #Feature Selection
    start_time2 = time.time()
    feature_selection_obj = FeatureSelection(InstanceSelector.representative_instances_list[0])
    feature_selection_obj.apply(InstanceSelector)
    end_time2 = time.time()
    algo2_time = end_time2-start_time2
    
    # print("Algo 1 time : ",algo1_time)
    # print("Algo 2 time : ",algo2_time)
    representative_instances = InstanceSelector.representative_instances_list
    # print("Instance set : ",representative_instances)
    feature_set = list(feature_selection_obj.rep_feature_set)
    # print("Feature set : ",feature_set)
    # time_taken[size] = end_time-start_time
    # print(len(InstanceSelector.representative_instances_list[0]))
    
    print("{:27s} |{:8s}|{:8s}|{:8s}|{:8s}".format("Model","Accuracy","Precision","Recall","F1-score"))
    print("-"*65)
    for model in models: