Beispiel #1
0
def tmmsss_merge(tmmsss0, tmmsss1):
    '''
    将两份包含样本数、平均值和方差、协方差的中间结果合并
    :param tmmsss0: 长度6的一维数组,分别记录了(count,mx,my,sxx,syy,sxy)
    :param tmmsss1: 长度6的一维数组,分别记录了(count,mx,my,sxx,syy,sxy)
    :return: 长度6的一维数组,分别记录了(count,mx,my,sxx,syy,sxy)
    '''
    count_0 = tmmsss0[0]
    mx_0 = tmmsss0[1]
    my_0 = tmmsss0[2]
    sxx_0 = tmmsss0[3]
    syy_0 = tmmsss0[4]
    sxy_0 = tmmsss0[5]
    count_1 = tmmsss1[0]
    mx_1 = tmmsss1[1]
    my_1 = tmmsss1[2]
    sxx_1 = tmmsss1[3]
    syy_1 = tmmsss1[4]
    sxy_1 = tmmsss1[5]
    _, _, sxx_total = ss_iteration(count_0, mx_0, sxx_0, count_1, mx_1, sxx_1)
    _, _, syy_total = ss_iteration(count_0, my_0, syy_0, count_1, my_1, syy_1)
    count_total, mx_total, my_total, sxy_total = sxy_iteration(
        count_0, mx_0, my_0, sxy_0, count_1, mx_1, my_1, sxy_1)
    return np.array(
        [count_total, mx_total, my_total, sxx_total, syy_total, sxy_total])
Beispiel #2
0
def tems_merge(tems0, tems1):
    '''
    :param tems0:
    :param tems1:
    :return:
    '''
    tems_array_list = []
    tems0_shape = list(tems0.shape)
    tems1_shape = list(tems1.shape)
    if tems0_shape != tems1_shape:
        print('tems0和tems0维度不匹配')
        return
    tems0 = tems0.reshape((-1, 4))
    tems1 = tems1.reshape((-1, 4))
    new_tmmsss1_shape = tems1.shape
    for line in range(new_tmmsss1_shape[0]):
        tems1_piece = tems1[line, :]
        tems0_piece = tems0[line, :]

        count_total, mx_total, sxx_total = ss_iteration(
            tems0_piece[0], tems0_piece[2], tems0_piece[3], tems1_piece[0],
            tems1_piece[2], tems1_piece[3])
        error_total = tems0_piece[1] + tems1_piece[1]
        tems_array_list.append(
            np.array([count_total, error_total, mx_total, sxx_total]))
    tems_array = np.array(tems_array_list)
    tems_array = tems_array.reshape(tems0_shape)
    return tems_array
Beispiel #3
0
def tmmsss_merge(tmmsss0, tmmsss1):
    '''
    将两份包含样本数、平均值和方差、协方差的中间结果合并
    :param tmmsss0: 长度6的一维数组,分别记录了(count,mx,my,sxx,syy,sxy)
    :param tmmsss1: 长度6的一维数组,分别记录了(count,mx,my,sxx,syy,sxy)
    :return: 长度6的一维数组,分别记录了(count,mx,my,sxx,syy,sxy)
    '''
    tmmsss_array_list = []
    tmmsss0_shape = list(tmmsss0.shape)
    tmmsss1_shape = list(tmmsss1.shape)
    if tmmsss0_shape != tmmsss1_shape:
        print('tmmsss0和tmmsss1维度不匹配')
        return
    tmmsss0 = tmmsss0.reshape((-1, 6))
    tmmsss1 = tmmsss1.reshape((-1, 6))
    new_tmmsss1_shape = tmmsss1.shape
    for line in range(new_tmmsss1_shape[0]):
        tmmsss1_piece = tmmsss1[line, :]
        tmmsss0_piece = tmmsss0[line, :]
        count_0 = tmmsss0_piece[0]
        mx_0 = tmmsss0_piece[1]
        my_0 = tmmsss0_piece[2]
        sxx_0 = tmmsss0_piece[3]
        syy_0 = tmmsss0_piece[4]
        sxy_0 = tmmsss0_piece[5]
        count_1 = tmmsss1_piece[0]
        mx_1 = tmmsss1_piece[1]
        my_1 = tmmsss1_piece[2]
        sxx_1 = tmmsss1_piece[3]
        syy_1 = tmmsss1_piece[4]
        sxy_1 = tmmsss1_piece[5]
        _, _, sxx_total = ss_iteration(count_0, mx_0, sxx_0, count_1, mx_1,
                                       sxx_1)
        _, _, syy_total = ss_iteration(count_0, my_0, syy_0, count_1, my_1,
                                       syy_1)
        count_total, mx_total, my_total, sxy_total = sxy_iteration(
            count_0, mx_0, my_0, sxy_0, count_1, mx_1, my_1, sxy_1)

        tmmsss_array_list.append(
            np.array([
                count_total, mx_total, my_total, sxx_total, syy_total,
                sxy_total
            ]))
    tmmsss_array = np.array(tmmsss_array_list)
    tmmsss_array = tmmsss_array.reshape(tmmsss0_shape)
    return tmmsss_array
Beispiel #4
0
def tems_merge(tems0, tems1):
    '''

    :param tems0:
    :param tems1:
    :return:
    '''
    count_total, mx_total, sxx_total = ss_iteration(tems0[0], tems0[2],
                                                    tems0[3], tems1[0],
                                                    tems1[2], tems1[3])
    error_total = tems0[1] + tems1[1]
    return np.array([count_total, error_total, mx_total, sxx_total])