def test_group_results():
    results = test_utilities.load_eng_trans_data()
    experiments, outcomes = results
    
    # test indices
    groups = {'set1':np.arange(0,11),
                           'set2':np.arange(11,25),
                           'set3':np.arange(25,experiments.shape[0])}
    groups = group_results(experiments, outcomes, 
                           group_by='index', 
                           grouping_specifiers=groups.values(),
                           grouping_labels= groups.keys())
    total_data = 0
    for value in groups.values():
        total_data += value[0].shape[0]
    print(experiments.shape[0], total_data)
    
    # test continuous parameter type
    array = experiments['average planning and construction period T1']
    grouping_specifiers = make_continuous_grouping_specifiers(array, nr_of_groups=5)
    groups = group_results(experiments, outcomes, 
                           group_by='average planning and construction period T1', 
                           grouping_specifiers=grouping_specifiers,
                           grouping_labels = [str(entry) for entry in grouping_specifiers]) 
    total_data = 0
    for value in groups.values():
        total_data += value[0].shape[0]
    print(experiments.shape[0], total_data)   
    
    # test integer type
    array = experiments['seed PR T1']
    grouping_specifiers = make_continuous_grouping_specifiers(array, nr_of_groups=10)
    groups = group_results(experiments, outcomes, 
                           group_by='seed PR T1', 
                           grouping_specifiers=grouping_specifiers,
                           grouping_labels = [str(entry) for entry in grouping_specifiers]) 
    total_data = 0
    for value in groups.values():
        total_data += value[0].shape[0]
    print(experiments.shape[0], total_data)   

    
    # test categorical type
    grouping_specifiers = set(experiments["policy"])
    groups = group_results(experiments, outcomes, 
                       group_by='policy', 
                       grouping_specifiers=grouping_specifiers,
                       grouping_labels = [str(entry) for entry in grouping_specifiers])
    total_data = 0
    for value in groups.values():
        total_data += value[0].shape[0]
    print(experiments.shape[0], total_data)   
Exemple #2
0
def test_make_continuous_grouping_specifiers():
    array = np.random.randint(1, 100, size=(1000, ))
    categories = make_continuous_grouping_specifiers(array, nr_of_groups=10)

    for entry in categories:
        print(repr(entry))
    print(np.min(array), np.max(array))
def test_make_continuous_grouping_specifiers():
    array = np.random.randint(1,100, size=(1000,))
    categories = make_continuous_grouping_specifiers(array, nr_of_groups=10)
    
    for entry in categories:
        print(repr(entry))
    print(np.min(array), np.max(array))