Skip to content

Commit

Permalink
fix: validation was incorrect (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjmachan authored Jul 27, 2023
1 parent 2b9734d commit 90db3ba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/ragas/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def validate_evaluation_modes(ds: Dataset, metrics: list[Metric]):
for m in metrics:
required_columns = set(EVALMODE_TO_COLUMNS[m.evaluation_mode])
available_columns = set(ds.features.keys())
if required_columns.symmetric_difference(available_columns):
if not required_columns.issubset(available_columns):
raise ValueError(
f"The metric [{m.name}] that that is used requires the following "
f"additional columns {list(required_columns - available_columns)} "
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@

TEST_CASES = [
CaseToTest("a", "b", ["c"], None, True, [faithfulness], True),
CaseToTest("a", "b", ["c"], ["g"], True, [faithfulness], False),
CaseToTest("a", "b", ["c"], ["g"], True, [faithfulness], True),
CaseToTest("a", None, ["c"], None, True, [context_relevancy], True),
CaseToTest("a", None, "c", None, False, [context_relevancy], True),
CaseToTest(
"a", None, [["c"]], None, False, [context_relevancy, answer_relevancy], False
),
CaseToTest("a", None, ["c"], "g", False, [context_relevancy], False),
CaseToTest("a", None, ["c"], [["g"]], False, [context_relevancy], False),
CaseToTest(1, None, ["c"], ["g"], False, [context_relevancy], False),
CaseToTest("a", None, ["c"], "g", False, [context_relevancy], True),
CaseToTest("a", None, ["c"], [["g"]], False, [context_relevancy], True),
CaseToTest(1, None, ["c"], ["g"], False, [context_relevancy], True),
CaseToTest(1, None, None, None, False, [context_relevancy], False),
]

Expand Down

0 comments on commit 90db3ba

Please sign in to comment.