ml_switcheroo.testing.fuzzer.heuristics¶

Name-Based Heuristics for Input Generation.

This module provides fallback logic for generating inputs when explicit type hints are missing, generally based on argument naming conventions.

Functions¶

guess_dtype_by_name(→ str)

Guesses the logical type of an argument based on its name.

generate_by_heuristic(→ Any)

Generates a value based on the argument name when no type hint is provided.

Module Contents¶

ml_switcheroo.testing.fuzzer.heuristics.guess_dtype_by_name(name: str) → str¶

Guesses the logical type of an argument based on its name.

Parameters:

name (str) – The argument name.

Returns:

‘bool’, ‘int’, or ‘float’.

Return type:

str

ml_switcheroo.testing.fuzzer.heuristics.generate_by_heuristic(name: str, base_shape: Tuple[int, Ellipsis], constraints: Dict[str, Any] = None) → Any¶

Generates a value based on the argument name when no type hint is provided.

Respects provided constraints if any.

Parameters:
  • name (str) – Argument name (e.g. ‘axis’, ‘x’).

  • base_shape (Tuple) – Default shape for array generation.

  • constraints (Dict) – Optional constraints (min/max/type).

Returns:

Generated value.

Return type:

Any