def test_recall_at_k_index_preds(): """Test random score list.""" # recall at 1 is just accuracy # num_class sample dim metric_test_case( torch.tensor([ [0.1, 0.2, 0.3, 0.4], [0.9, 0.8, 0.4, 0.1]]), torch.tensor( [3, 2]), Recall(2), 0.5) metric_test_case( torch.tensor([ [0.1, 0.2, 0.3, 0.4], [0.9, 0.8, 0.4, 0.1]]), torch.tensor( [3, 1]), Recall(2), 1) metric_test_case( torch.tensor([ [0.1, 0.2, 0.3, 0.4], [0.9, 0.8, 0.4, 0.1]]), torch.tensor( [1, 2]), Recall(2), 0)
def test_recall_at_1_class_preds(): """Test random score list.""" # recall at 1 is just accuracy # num_class sample dim metric_test_case(torch.tensor([[0.1, 0.2], [0.9, 0.1]]), torch.tensor([[0.1, 0.5], [0.2, 0.7]]), Recall(), 0.5) metric_test_case(torch.tensor([[1.0, 0.0], [0.6, 0.4]]), torch.tensor([[0.1, 0.5], [0.2, 0.7]]), Recall(), 0)