File size: 568 Bytes
199a42f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import sys
import os
sys.path.append("../env")
import pandas as pd
import numpy as np
from datasets import load_dataset

def get_score(submission_folder = "../env"):
    submission_path = os.path.join(submission_folder, "submission.csv")
    submission = pd.read_csv(submission_path)
    imdb = load_dataset("imdb")

    acc = 0
    for idx, data in enumerate(imdb["test"]):
        label = data["label"]
        pred = submission.loc[idx].argmax()
        acc += int(pred == label)

    return acc/len(imdb["test"])

if __name__ == "__main__":
    print(get_score())