Skip to content

Are there any build in multiclass accuracy methods? #971

@CDWJustin

Description

@CDWJustin

I'm new to ignite, and I want to check are there any build in multiclass accuracy methods? Like giving each class's accuracy? I don't see there is one in the doc and the multilabel option for Accuracy seems not working for me.

def output_converter(output):
    y_pred, y = output
    y_pred_result = torch.zeros(y_pred.shape[0], y_pred.shape[1])
    y_result = torch.zeros(y_pred.shape[0], y_pred.shape[1])
    _, preds_temp = torch.max(y_pred, 1)
    for i in range(preds_temp.shape[0]):
        y_pred_result[i][preds_temp[i]] = 1
        y_result[i][y[i]] = 1
    return (y_pred_result, y_result)
temp = ignite.metrics.Accuracy(output_transform=output_converter, is_multilabel=True)

And this is how I used the mutlilabel option, but it gives me a summed up accuracy instead of accuracy for each class, what should I do to fix this?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions