kaggle-Digit Recognizer结果融合

import pandas as pd


p1 = pd.read_csv("./data/mmnist/mnist_res 987.csv")
p2 = pd.read_csv("./data/mmnist/mnist_res988.csv")
p3 = pd.read_csv("./data/mmnist/yymnist_res985.csv")
p4 = pd.read_csv("./data/mmnist/yymnist_res986.csv")
p5 = pd.read_csv("./data/mmnist/mnist_res984.csv")
p6 = pd.read_csv("./data/mmnist/yymnist_res9855.csv")
p7 = pd.read_csv("./data/mmnist/mnist_res9824.csv")
p8 = pd.read_csv("./data/mmnist/yymnist_res9822.csv")
p9 = pd.read_csv("./data/mmnist/mnist_res988.csv")
p10 = pd.read_csv("./data/mmnist/mnist_res 987.csv")
p11 = pd.read_csv("./data/mmnist/mnist_res988.csv")

res  = []
id_len = len(p1["ImageId"])
print("id_le:", id_len)
for i in range(id_len):
    print("i:", i)

    a1 = p1["Label"][i]
    a2 = p2["Label"][i]
    a3 = p3["Label"][i]
    a4 = p4["Label"][i]
    a5 = p5["Label"][i]
    a6 = p6["Label"][i]
    a7 = p7["Label"][i]
    a8 = p8["Label"][i]
    a9 = p9["Label"][i]
    a10 = p10["Label"][i]
    a11 = p11["Label"][i]
    # print(a1)
    # print(a2)
    # print(a3)
    # print(a4)
    # break
    temp_res = []
    temp_res.append(a1)
    temp_res.append(a2)
    temp_res.append(a3)
    temp_res.append(a4)
    temp_res.append(a5)
    temp_res.append(a6)
    temp_res.append(a7)
    temp_res.append(a8)
    temp_res.append(a9)
    temp_res.append(a10)
    temp_res.append(a11)
    tmp = {i: temp_res.count(i) for i in set(temp_res)}
    # 找出次数最大的那个
    you_want = max(zip(tmp.values(), tmp.keys()))[1]

    res.append(you_want)
import numpy as np
res_to_np = np.array(res)

import pandas as pd
pd = pd.read_csv("./data/mmnist/sample_submission.csv")
print("res_to_np.shape:", res_to_np.shape)
pd["Label"] = res_to_np
pd.to_csv("./data/mmnist/gzmnist_res.csv", index=False)
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 精致技术 设计师: CSDN官方博客
应支付0元
点击重新获取
扫码支付

支付成功即可阅读