
Databricks Certified Machine Learning - Associate
Get started today
Ultimate access to all questions.
Which Hyperopt function is specifically designed to generate a random integer within the range [0, upper)?
Which Hyperopt function is specifically designed to generate a random integer within the range [0, upper)?
Real Exam
Explanation:
The correct answer is hp.randint(label, upper)
, as it is specifically designed to generate random integers within a specified range. The label
serves as an identifier for the hyperparameter, and upper
defines the upper bound (exclusive) for the random integer generation. Values are chosen from 0 (inclusive) up to, but not including, upper
.
Other options are not suitable for this purpose:
hp.quniform(label, low, high, q)
: Generates random numbers following a q-uniform distribution within a specified range, not guaranteeing integers or the desired range.hp.uniform(label, low, high)
: Generates random floats within a specified range, not integers.hp.choice(label, options)
: Selects a random element from a list of predefined options, not suitable for generating random integers within a specific range.
Thus, hp.randint(label, upper)
is the most appropriate function for generating random integers in the range [0, upper).