方法一:
# 打乱索引
import numpy as np
index = [i for i in range(len(test_data))] # test_data为测试数据
np.random.shuffle(index) # 打乱索引
test_data = test_data[index]
test_label = test_label[index]
方法二:
# 利用随机数种子
import numpy as np
np.random.seed(12)
np.random.shuffle(test_data)
np.random.seed(12)
np.random.shuffle(test_label)
参考资料:
https://blog.csdn.net/liuweizj12/article/details/80020861
https://blog.csdn.net/xijuezhu8128/article/details/80162558