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

Fixed ground truth formats to include hdf5 #3557

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions ludwig/visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
CACHEABLE_FORMATS,
data_reader_registry,
figure_data_format_dataset,
HDF5_FORMATS,
load_array,
load_from_file,
load_json,
Expand All @@ -58,6 +59,8 @@
_CSV_SUFFIX = "csv"
_PARQUET_SUFFIX = "parquet"

GROUND_TRUTH_FORMATS = CACHEABLE_FORMATS | HDF5_FORMATS


def _convert_ground_truth(ground_truth, feature_metadata, ground_truth_apply_idx, positive_label):
"""converts non-np.array representation to be np.array."""
Expand Down Expand Up @@ -229,9 +232,9 @@ def _encode_categorical_feature(raw: np.array, str2idx: dict) -> np.array:
def _get_ground_truth_df(ground_truth: str) -> DataFrame:
# determine ground truth data format and get appropriate reader
data_format = figure_data_format_dataset(ground_truth)
if data_format not in CACHEABLE_FORMATS:
if data_format not in GROUND_TRUTH_FORMATS:
raise ValueError(
"{} is not supported for ground truth file, " "valid types are {}".format(data_format, CACHEABLE_FORMATS)
f"{data_format} is not supported for ground truth file, valid types are {GROUND_TRUTH_FORMATS}"
)
reader = get_from_registry(data_format, data_reader_registry)

Expand Down
Loading