Hypster Docs
Github 🌟Contact Us
  • 👋Welcome
  • Getting Started
    • 🖥️Installation
    • 🚀Defining of A Config Function
    • ⚡Instantiating a Config Function
    • 🍡Selecting Output Variables
    • 🎮Interactive Instantiation (UI)
    • 🪄Usage Examples
      • Machine Learning
      • LLM Generation
  • In Depth
    • 🤖Parameter Naming
    • 🍱HP Call Types
      • Selectable Types
      • Numeric Types
      • Boolean Types
      • Textual Types
      • Nested Configurations
    • 🧠Best Practices
Powered by GitBook

Contact & Follow the Author

  • Website
  • LinkedIn
  • Github
  • Medium

© Gilad Rubin 2024

On this page
  • Function Signatures
  • Usage Examples
  • Single Boolean Values
  • Multiple Boolean Values
  • Invalid Values
  • Reproducibility

Was this helpful?

Edit on GitHub
  1. In Depth
  2. HP Call Types

Boolean Types

Hypster provides boolean parameter configuration through bool and multi_bool methods. These methods handle boolean values without additional validation.

Function Signatures

def bool(
    default: bool,
    *,
    name: Optional[str] = None
) -> bool

def multi_bool(
    default: List[bool] = [],
    *,
    name: Optional[str] = None
) -> List[bool]

Usage Examples

Single Boolean Values

# Single boolean parameter with default
stream = hp.bool(True)
use_cache = hp.bool(False)

# Usage
config(values={"stream": False})
config(values={"use_cache": True})

Multiple Boolean Values

# Multiple boolean parameters with defaults
layer_trainable = hp.multi_bool([True, True, False])
feature_flags = hp.multi_bool([False, False])

# Usage
config(values={"layer_trainable": [False, True, True]})
config(values={"feature_flags": [True, False, True]})

Invalid Values

# These will raise errors
config(values={"stream": "true"})  # String instead of boolean
config(values={"layer_trainable": [1, 0]})  # Numbers instead of booleans

Reproducibility

All boolean parameters are fully serializable and reproducible:

# Configuration will be exactly reproduced
snapshot = config.get_last_snapshot()
restored_config = config(values=snapshot)
PreviousNumeric TypesNextTextual Types

Last updated 6 months ago

Was this helpful?

🍱