Skip to content

Commit

Permalink
support no target name in dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
mzouink committed Jul 8, 2024
1 parent cca5064 commit c7752f5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions dacapo/experiments/datasplits/datasplit_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ def check_class_name(self, class_name):
"""
datasets, classes = format_class_name(
class_name, self.classes_separator_caracter
class_name, self.classes_separator_caracter, self.targets
)
if self.class_name is None:
self.class_name = classes
Expand Down Expand Up @@ -893,7 +893,7 @@ def generate_from_csv(
)


def format_class_name(class_name, separator_character="&"):
def format_class_name(class_name, separator_character="&", targets=None):
"""
Format the class name.
Expand All @@ -919,4 +919,8 @@ def format_class_name(class_name, separator_character="&"):
base_class_name = class_name.split("[")[0]
return [f"{base_class_name}{c}" for c in classes], classes
else:
raise ValueError(f"Invalid class name {class_name} missing '[' and ']'")
if targets is None:
raise ValueError(f"Invalid class name {class_name} missing '[' and ']'")
if len(targets) > 1:
raise ValueError(f"Invalid class name {class_name} missing '[' and ']'")
return [class_name], [targets[0]]

0 comments on commit c7752f5

Please sign in to comment.