Ejemplo n.º 1
0
def extract_information(results, name, radius=None):
    print '***** extracting the information *****'
    info = Information(name)

    for result in results:
        # print len(result['typeProbHistory'])
        # print (len(result['historyParameters']))
        # print info.AGA_max_len_hist
        # print info.ABU_max_len_hist
        # print info.PF_max_len_hist
        if result['estimationMode'] == 'AGA':
            if len(result['typeProbHistory']) > info.AGA_max_len_hist:
                info.AGA_max_len_hist = len(result['typeProbHistory'])

            info.AGA_estimationHist.append(result['historyParameters'])
            info.AGA_typeProbHistory.append(result['typeProbHistory'])
            info.AGA_trueParameter.append(result['trueParameters'])
            info.AGA_errors.append(
                calculate_error(result['trueParameters'],
                                result['historyParameters']))

        if result['estimationMode'] == 'ABU':
            if len(result['typeProbHistory']) > info.ABU_max_len_hist:
                info.ABU_max_len_hist = len(result['typeProbHistory'])

            info.ABU_estimationHist.append(result['historyParameters'])
            info.ABU_typeProbHistory.append(result['typeProbHistory'])
            info.ABU_trueParameter.append(result['trueParameters'])
            info.ABU_errors.append(
                calculate_error(result['trueParameters'],
                                result['historyParameters']))

        if result['estimationMode'] == 'MIN':
            if radius != None:
                print radius, result['mainAgentRadius'], radius == result[
                    'mainAgentRadius']
                if radius == result['mainAgentRadius']:
                    if len(result['typeProbHistory']) > info.PF_max_len_hist:
                        info.PF_max_len_hist = len(result['typeProbHistory'])

                    info.PF_typeProbHistory.append(result['typeProbHistory'])
                    info.PF_estimationHist.append(result['historyParameters'])
                    info.PF_trueParameter.append(result['trueParameters'])
                    info.PF_errors.append(
                        calculate_error(result['trueParameters'],
                                        result['historyParameters']))
            else:
                if len(result['typeProbHistory']) > info.PF_max_len_hist:
                    info.PF_max_len_hist = len(result['typeProbHistory'])

                info.PF_typeProbHistory.append(result['typeProbHistory'])
                info.PF_estimationHist.append(result['historyParameters'])
                info.PF_trueParameter.append(result['trueParameters'])
                info.PF_errors.append(
                    calculate_error(result['trueParameters'],
                                    result['historyParameters']))

    return info
Ejemplo n.º 2
0
def extract_information(results, name, radius=None):

    # print '***** extracting the information *****'
    info = Information(name)

    for result in results:
        # print len(result['typeProbHistory'])
        # print (len(result['historyParameters']))
        # print info.AGA_max_len_hist
        # print info.ABU_max_len_hist
        # print info.OGE_max_len_hist
        if result['parameter_estimation_mode'] == 'TRUE':
            # print 'true'
            # print 'time step:', result['timeSteps']
            # print result['type_estimation_mode']
            if len(result['typeProbHistory']) > info.TRUE_max_len_hist:
                info.TRUE_max_len_hist = len(result['typeProbHistory'])

            info.TRUE_timeSteps.append(result['timeSteps'])
            # info.TRUE_estimationHist.append(result['historyParameters'])
            # info.TRUE_typeProbHistory.append(result['typeProbHistory'])
            # info.TRUE_trueParameter.append(result['trueParameters'])
            # info.TRUE_errors.append(calculate_error(result['trueParameters'], result['historyParameters']))

        if result['parameter_estimation_mode'] == 'AGA':
            if len(result['typeProbHistory']) > info.AGA_max_len_hist:
                info.AGA_max_len_hist = len(result['typeProbHistory'])

            info.AGA_timeSteps.append(result['timeSteps'])
            info.AGA_estimationHist.append(result['historyParameters'])
            info.AGA_typeProbHistory.append(result['typeProbHistory'])
            info.AGA_trueParameter.append(result['trueParameters'])
            error = calculate_error(result['trueParameters'],
                                    result['historyParameters'])
            # print 'AGA', result['path'], error
            info.AGA_errors.append(error)

        if result['parameter_estimation_mode'] == 'ABU':
            if len(result['typeProbHistory']) > info.ABU_max_len_hist:
                info.ABU_max_len_hist = len(result['typeProbHistory'])

            info.ABU_timeSteps.append(result['timeSteps'])
            info.ABU_estimationHist.append(result['historyParameters'])
            info.ABU_typeProbHistory.append(result['typeProbHistory'])
            info.ABU_trueParameter.append(result['trueParameters'])
            error = calculate_error(result['trueParameters'],
                                    result['historyParameters'])
            # print 'ABU', result['path'] , error
            info.ABU_errors.append(error)

        if result['parameter_estimation_mode'] == 'MIN':
            if radius != None:
                # print radius, result['mainAgentRadius'], radius == result['mainAgentRadius']
                if radius == result['mainAgentRadius']:
                    if len(result['typeProbHistory']) > info.OGE_max_len_hist:
                        info.OGE_max_len_hist = len(result['typeProbHistory'])

                    info.OGE_timeSteps.append(result['timeSteps'])
                    info.OGE_typeProbHistory.append(result['typeProbHistory'])
                    info.OGE_estimationHist.append(result['historyParameters'])
                    info.OGE_trueParameter.append(result['trueParameters'])
                    error = calculate_error(result['trueParameters'],
                                            result['historyParameters'])
                    # print 'OGE', result['path'], error
                    info.OGE_errors.append(error)
            else:
                if len(result['typeProbHistory']) > info.OGE_max_len_hist:
                    info.OGE_max_len_hist = len(result['typeProbHistory'])

                info.OGE_timeSteps.append(result['timeSteps'])
                info.OGE_typeProbHistory.append(result['typeProbHistory'])
                info.OGE_estimationHist.append(result['historyParameters'])
                info.OGE_trueParameter.append(result['trueParameters'])
                error = calculate_error(result['trueParameters'],
                                        result['historyParameters'])

                # print 'OGE', result['path'], error
                info.OGE_errors.append(error)

    # print name
    print "number of AGA: ", len(info.AGA_timeSteps)
    print "number of ABU: ", len(info.ABU_timeSteps)
    print "number of OGE: ", len(info.OGE_timeSteps)
    return info