Skip to content
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
25 changes: 25 additions & 0 deletions openml/_api_calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,31 @@ def __parse_server_exception(
else:
full_message = f"{message} - {additional_information}"

# Improve estimation_procedure error message
if additional_information and "acceptable inputs" in additional_information:
try:
import re

from openml.tasks.functions import _get_estimation_procedure_list

# Extract IDs
ids = list(map(int, re.findall(r"\d+", additional_information)))

# Get mapping
procedures = _get_estimation_procedure_list()
mapping = {p["id"]: p["name"] for p in procedures}

# Format
pretty = [f"{i}: {mapping.get(i, 'Unknown')}" for i in ids]

full_message = (
f"{message} - problematic input: [estimation_procedure],\n"
"acceptable inputs:\n" + "\n".join(pretty)
)

except Exception:
pass

if code in [
102, # flow/exists post
137, # dataset post
Expand Down