Ejemplo n.º 1
0
    input_secondc2 = input_secondc2.values
    #放入11分类器中进一步分类
    r_finally3 = np.array(second_check2(input_secondc2))[:, np.newaxis]
    r_finally = np.vstack((r_finally1, r_finally2, r_finally3))
    r_real = np.vstack(
        (input_firstc[:, -1][:, np.newaxis], input_secondc1[:, -1][:,
                                                                   np.newaxis],
         input_secondc2[:, -1][:, np.newaxis]))
    return r_finally, r_real


if __name__ == '__main__':
    p = r'/home/xiaosong/桌面/pny相关数据/data_pny/PNY_all.pickle'
    input = LoadFile(p=p)
    np.random.shuffle(input)
    dataset_4feature, dataset_dense, label = input[:, :
                                                   4], input[:, 4:
                                                             -1], input[:,
                                                                        -1][:,
                                                                            np.
                                                                            newaxis]
    dataset_fft = fft_transformer(dataset_dense, 100)
    dataset = np.hstack((dataset_4feature, dataset_fft, label))
    dataset_guiyi_2 = guiyi(dataset)
    print(dataset_guiyi_2.shape)
    r_finally, r_real = check(input=dataset_guiyi_2[:5100, :])
    r_1 = np.where(np.abs(r_finally - r_real) < 1e-2, 1, 0)
    r_sum = np.sum(r_1)
    acc = r_sum / r_1.shape[0]
    print('5100个测试样本的预测精确度为: %s' % acc)
Ejemplo n.º 2
0
    return fft_abs


if __name__ == '__main__':
    p = r'/home/xiaosong/桌面/OLDENBURG_all.pickle'
    dataset = LoadFile(p)
    nums_cl = [[6557, 0], [611, 2], [101, 2], [13, 2], [554, 2], [155, 2],
               [100, 2], [1165, 1], [1993, 1], [947, 2], [1133, 2], [1152, 1],
               [542, 2], [754, 2], [2163, 1]]
    dataset_output = making(nums_cl=nums_cl, dataset=dataset)
    print(dataset_output.shape)
    checkclassifier(dataset_output[:, -1])
    # SaveFile(dataset_output, savepickle_p=r'/home/xiaosong/桌面/OLDENBURG_3cl.pickle')
    dataset_4feature, dataset_dense, label = dataset_output[:, :
                                                            4], dataset_output[:,
                                                                               4:
                                                                               -1], dataset_output[:,
                                                                                                   -1][:,
                                                                                                       np
                                                                                                       .
                                                                                                       newaxis]
    dataset_fft = fft_transformer(dataset_dense, 100)
    dataset = np.hstack((dataset_4feature, dataset_fft, label))
    dataset_guiyi = guiyi(dataset)
    print(dataset_guiyi.shape)
    # print(np.min(dataset_guiyi, axis=0))
    SaveFile(data=dataset_guiyi,
             savepickle_p=r'/home/xiaosong/桌面/OLDENBURG_3cl.pickle')
    dataset_onehot = onehot(dataset_guiyi)
    print(np.sum(dataset_onehot[:, -3:], axis=0))