def read_train_example(path='../../data/train_example.bson', pca_reduction=True):
    read_result = SimpleBSONReader.read_all(path)
    pixels = read_result.pixel_matrix
    numpy.savetxt('../../out/train_example.csv', pixels, delimiter=',', fmt='%.d')
    if pca_reduction:
        pixel_reduced = read_result.pixel_matrix_reduced
        numpy.savetxt('../../out/pca_train_example.csv', pixel_reduced, delimiter=',', fmt='%.d')
    return pixels
def read_train_example(path='../../data/train_example.bson', pca_reduction=True):
    read_result = SimpleBSONReader.read_all(path)
    pixels = read_result.pixel_matrix
    numpy.savetxt('../../out/train_example.csv', pixels, delimiter=',', fmt='%.d')
    if pca_reduction:
        pixel_reduced = read_result.pixel_matrix_reduced
        numpy.savetxt('../../out/pca_train_example.csv', pixel_reduced, delimiter=',', fmt='%.d')
    return pixels