Skip to content

Commit

Permalink
add logging info for parameter that uses e notation to inform them th…
Browse files Browse the repository at this point in the history
…at the parameter gets deduced as float
  • Loading branch information
danrgll committed Feb 4, 2024
1 parent 300b5a3 commit 14a9189
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion neps/search_spaces/yaml_search_space_utils.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
from __future__ import annotations

import logging
import re

logger = logging.getLogger(__name__)


def convert_scientific_notation(value: str | int | float, show_usage_flag=False) \
-> float | (float, bool):
-> float | (float, bool):
"""
Convert a given value to a float if it's a string that matches scientific e notation.
This is especially useful for numbers like "3.3e-5" which YAML parsers may not
Expand Down Expand Up @@ -156,6 +159,10 @@ def deduce_param_type(name: str, details: dict[str, int | str | float]) -> str:

# check if one value is e notation and if so convert it to float
if flag_lower or flag_upper:
logger.info(
f"Because of e notation, Parameter {name} gets "
f"interpreted as float"
)
param_type = "float"
else:
raise TypeError(
Expand Down

0 comments on commit 14a9189

Please sign in to comment.