Skip to content

search_space

Search spaces for hyperparameter optimization of TabPFN models.

This module provides predefined search spaces for TabPFN classifier and regressor hyperparameter optimization. It also includes utilities for customizing search spaces.

TabPFNSearchSpace

Utility class for creating and customizing TabPFN hyperparameter search spaces.

This class provides methods to generate default search spaces for both classification and regression tasks, as well as customizing parameter ranges.

Examples:

# Get default classifier search space
clf_space = TabPFNSearchSpace.get_classifier_space()

# Get customized classifier search space
custom_space = TabPFNSearchSpace.get_classifier_space(
    n_ensemble_range=(5, 15),
    temp_range=(0.1, 0.5)
)

# Use with TunedTabPFNClassifier
from tabpfn_extensions.hpo import TunedTabPFNClassifier

clf = TunedTabPFNClassifier(
    n_trials=50,
    search_space=custom_space
)

get_classifier_space staticmethod

get_classifier_space(
    n_ensemble_range: tuple[int, int] = (1, 8),
    temp_range: tuple[float, float] = (0.75, 1.0),
) -> dict[str, Any]

Get a search space for classification tasks.

Parameters:

Name Type Description Default
n_ensemble_range tuple[int, int]

Range for n_estimators parameter as (min, max)

(1, 8)
temp_range tuple[float, float]

Range for softmax_temperature as (min, max)

(0.75, 1.0)

Returns:

Type Description
dict[str, Any]

Dictionary with search space parameters

get_regressor_space staticmethod

get_regressor_space(
    n_ensemble_range: tuple[int, int] = (1, 8),
    temp_range: tuple[float, float] = (0.75, 1.0),
) -> dict[str, Any]

Get a search space for regression tasks.

Parameters:

Name Type Description Default
n_ensemble_range tuple[int, int]

Range for n_estimators parameter as (min, max)

(1, 8)
temp_range tuple[float, float]

Range for softmax_temperature as (min, max)

(0.75, 1.0)

Returns:

Type Description
dict[str, Any]

Dictionary with search space parameters

get_param_grid_hyperopt

get_param_grid_hyperopt(task_type: str) -> dict

Generate the full hyperopt search space for TabPFN optimization.

Parameters:

Name Type Description Default
task_type str

Either "multiclass" or "regression"

required

Returns:

Type Description
dict

Hyperopt search space dictionary