Looking for usage documentation? Check out Classification, Thinking mode and KV cache.
TabPFNClassifier
</> View source ↗create_default_for_version()
instead. You can also use model_path to specify a particular model.
TabPFNClassifier(
model_path: str | None = None,
n_estimators: int | None = None,
softmax_temperature: float | None = None,
balance_probabilities: bool = False,
average_before_softmax: bool | None = None,
ignore_pretraining_limits: bool = False,
inference_precision: Literal["autocast", "auto"] | None = None,
random_state: int | None = 0,
inference_config: dict[str, Any] | None = None,
categorical_features_indices: list[int] | None = None,
fit_mode: FitModeLiteral | None = None,
paper_version: bool = False,
thinking_mode: bool = False,
thinking_effort: ThinkingEffort | None = None,
thinking_timeout_s: float | None = None,
thinking_metric: str | None = None,
group_col: str | list[str] | None = None,
time_col: str | None = None,
group_time_col: str | None = None,
api_mode: ApiMode = ApiMode.AUTO,
client_options: ClientOptions | None = None,
text_handling: TextHandling = "advanced",
)
Type aliases
Type aliases
TextHandling = Literal["advanced", "simple"]
| Parameter | Type | Default | Description |
|---|---|---|---|
model_ | str | None | None | The name of the model to use. “auto” (or None) lets the server pick the latest default model; “default” is accepted as a backward-compatible alias. Use create_default_for_version() to pin to a specific major version, and list_available_models() for the accepted names. |
n_ | int | None | None | The number of estimators in the TabPFN ensemble. We aggregate the predictions of n_estimators-many forward passes of TabPFN. Each forward pass has (slightly) different input data. Think of this as an ensemble of n_estimators-many “prompts” of the input data. The server accepts at most 8. If None, it applies the model’s default:- v3.5 ( "v3.5_default", the default model): 8.- v3.5-fast ( "v3.5-fast_default"): 4.- v3 ( "v3_default"): 8, raised on wide datasets until every feature is seen by at least one estimator, up to 32.These are server defaults and may change with server releases. |
softmax_ | float | None | None | The temperature for the softmax function. This is used to control the confidence of the model’s predictions. Lower values make the model’s predictions more confident. This is only applied when predicting during a post-processing step. Set softmax_temperature=1.0 for no effect. If None, the server default is used. |
balance_ | bool | False | Whether to balance the probabilities based on the class distribution in the training data. This can help to improve predictive performance when the classes are highly imbalanced. This is only applied when predicting during a post-processing step. |
average_ | bool | None | None | Only used if n_estimators > 1. Whether to average the predictions of the estimators before applying the softmax function. This can help to improve predictive performance when there are many classes or when calibrating the model’s confidence. This is only applied when predicting during a post-processing step. If None, the server default is used. |
ignore_ | bool | False | Whether to ignore the pre-training limits of the model. The TabPFN models have been pre-trained on a specific range of input data. If the input data is outside of this range, the model may not perform well. You may ignore our limits to use the model on data outside the pre-training range. |
inference_ | Literal[“autocast”, “auto”] | None | None | The precision to use for inference. This can dramatically affect the speed and reproducibility of the inference. "autocast" enables mixed-precision autocast; "auto" decides based on the device. If None, the server default is used. |
random_ | int | None | 0 | Controls the randomness of the model. Pass an int for reproducible results; pass None to use a fresh random seed each run. |
inference_ | dict[str, Any] | NoneInferenceConfig options | None | For advanced users, additional advanced arguments that adjust the behavior of the model interface. See InferenceConfig in the tabpfn package for details and options. For the client, the inference_config and the preprocess transforms need to be dictionaries. |
categorical_ | list[int] | None | None | The indices of the columns that should be treated as categorical. If None, the model infers which columns are categorical. |
fit_ | Fit | None | Controls what the server persists at fit time. None defers to the server default, which is “fit_preprocessors”.- If "fit_preprocessors", only the preprocessing state is fitted, so every predict re-runs the forward pass from the uploaded train set.- If "fit_with_cache", a server-side KV cache is additionally built and persisted, keyed by the resulting fitted-train-set id. Later predicts against that id (stored on the estimator as model_id_, and persisted across runs by save_model()) are served from the cache instead of re-fitting. |
paper_ | bool | False | If True, will use the model described in the paper, instead of the newest version available on the API, which e.g. handles text features better. Cannot be combined with thinking mode. |
thinking_ | bool | False | If True, spend extra fit-time compute for higher precision. Equivalent to passing thinking_effort="medium"; setting any thinking_effort value also enables thinking, so this flag is optional when you’ve set the level explicitly. |
thinking_ | Thinking | None | Effort level for thinking mode. When set, thinking is enabled (you don’t also need thinking_mode=True). When None and thinking_mode=True, defaults to “medium”. |
thinking_ | float | None | None | Budget for the fit, in seconds. Only consulted when thinking is enabled. Capped at 2400. |
thinking_ | str | None | None | Optimization metric for the fit. Only consulted when thinking is enabled. Binary classification: “accuracy”, “balanced_accuracy”, “mcc”, “log_loss”, “pac”, “quadratic_kappa”, “roc_auc”, “average_precision”, “precision”, “precision_macro”, “precision_micro”, “precision_weighted”, “recall”, “recall_macro”, “recall_micro”, “recall_weighted”, “f1”, “f1_macro”, “f1_micro”, “f1_weighted”. Multiclass classification: “accuracy”, “balanced_accuracy”, “mcc”, “log_loss”, “pac”, “quadratic_kappa”, “precision_macro”, “precision_micro”, “precision_weighted”, “recall_macro”, “recall_micro”, “recall_weighted”, “f1_macro”, “f1_micro”, “f1_weighted”, “roc_auc_ovo”, “roc_auc_ovo_macro”, “roc_auc_ovr”, “roc_auc_ovr_macro”, “roc_auc_ovr_micro”, “roc_auc_ovr_weighted”. Aliases “acc”, “nll”, “pac_score” are also accepted. |
group_ | str | list[str] | None | None | New since 0.6.0. Column(s) of X that identify groups of related rows, e.g. a patient or a session id. During the fit, the rows of one group are never split between training and validation. The fit may also use the other rows of a group to predict a row of it. Requires thinking mode, and X passed to fit and predict must be a pandas DataFrame that holds the column(s). |
time_ | str | None | None | New since 0.6.0. Column of X that holds time, as datetimes or numbers. During the fit, validation uses contiguous blocks of time. Cannot be combined with group_col. Requires thinking mode, and X must be a pandas DataFrame that holds the column. |
group_ | str | None | None | New since 0.6.0. Column of X that orders the rows within a group. Requires group_col and thinking mode, and X must be a pandas DataFrame that holds the column. |
api_ | Api | ApiMode.AUTO | Controls how the client calls the server. - SYNC: the client waits for the server to complete the request before returning.- ASYNC: the client returns immediately and the server completes the request in the background.- AUTO: the client determines the best mode based on the request. |
client_ | Client | None | Client specific options (e.g. timeout, headers). |
text_ | Text | "advanced" | Text-processing preset. Both choices support text. Advanced preserves the default processing; simple is an alternative whose accuracy depends on the dataset. Applies when preprocessing is enabled. |
- TabPFN-3 and later versions support up to 1,000,000 rows, subject to feature count and model/API limits.
- For large datasets, use per-estimator subsampling,
e.g.
inference_config={"SUBSAMPLE_SAMPLES": 100_000}. - Pass raw pandas DataFrames to
fitandpredict. Categorical strings/categories, raw text, and missing feature values are handled automatically; no manual integer/one-hot encoding, imputation, scaling, or outlier removal is needed.
Scikit-learn configuration
Use inheritedget_params and set_params to inspect or update constructor settings.