Skip to content

On-premise users: click in-app to access the full platform documentation for your version of DataRobot.

Configure hyperparameters for custom tasks

Availability information

Hyperparameters for custom tasks is off by default. Contact your DataRobot representative or administrator for information on enabling the feature.

Feature flag: Enable Custom Task Hyperparameters

Now available for preview, you can define hyperparameters for a custom task. Add and configure hyperparameters in the model-metadata.yaml file.

You must specify two values for each hyperparameter: the name and type. The type can be one of int, float, string, select, or multi. All types support a default value. Integer and float values can have a min and max value specified. Certain type parameters require a list in the values field to define the accepted values. String type hyperparameters can accept any arbitrary string. Multi types have values specified as multiple of the aforementioned types, e.g. float and select.

View an example set of hyperparameters below.

hyperparameters:
  # int: Integer value, must provide a min and max. Default is optional. Uses the min value if not provided.
  - name: seed
    type: int
    min: 0
    max: 10000
    default: 64
  # int: Integer value, must provide a min and max. Default is optional. Uses the min value if not provided.
  - name: kbins_n_bins
    type: int
    min: 2
    max: 1000
    default: 10
  # select: A discrete set of unique values, similar to an enum. Default is optional. Will use the first value if
  # not provided.
  - name: kbins_strategy
    type: select
    values:
      - uniform
      - quantile
      - kmeans
    default: quantile
  # multi: A parameter that can be of multiple types (int/float/select). Default is optional. Will use the first parameter
  # type's default value. This example uses select, the first entry, or for int/float, the min value.
  - name: missing_values_strategy
    type: multi
    values:
      float:
        min: -1000000.0
        max: 1000000.0
      select:
        values:
        - median
        - mean
        - most_frequent
    default: median
  # string: Unicode string. Default is optional. Is an empty string if not provided.
  - name: print_message
    type: string
    default: "hello world 🚀"

Access a custom task's hyperparameters via the fit method and add parameters to the fit function arguments, as shown below.

def fit(
    X: pd.DataFrame,
    y: pd.Series,
    output_dir: str,
    class_order: Optional[List[str]] = None,
    row_weights: Optional[np.ndarray] = None,
    parameters: Optional[dict] = None,
    **kwargs,
):

Updated March 26, 2024