Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

评测代码 #1

Open
cobraheleah opened this issue Jun 27, 2023 · 1 comment
Open

评测代码 #1

cobraheleah opened this issue Jun 27, 2023 · 1 comment

Comments

@cobraheleah
Copy link

请问评测代码在哪里

@GanjinZero
Copy link
Owner

没有清理出完整的代码

def cal_accu(pred, gtrue):

    accu_count = 0
    idx = 0
    for p, gt in zip(pred, gtrue):
        if p:
            if abs(float(p) - float(gt)) < 1e-3:
                accu_count += 1
            else:
                pass
                # print(idx, p, gt)
        else:
            pass
            # print(idx, p, gt)
        idx += 1
    
    return accu_count / len(pred)

def average_error(pred, gtrue):

    errors = 0
    for p, gt in zip(pred, gtrue):
        if p:
            # print(float(p), float(gt))
            errors += min(10, abs(float(p) - float(gt)) / max(abs(float(gt)), 1))
        else:
            errors += 10

    return errors / len(pred)

def non_number_rate(pred, gtrue):

    count = 0
    for p, gt in zip(pred, gtrue):
        if not p:
            count += 1
    return count / len(pred)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants