Looking for usage documentation? Check out Regression and KV cache.
TabPFNRegressor.fit
View source submit_fit().
The model takes the new fit as soon as the server has accepted it. A
fit that fit() polls for, as an ASYNC or thinking-mode one, is then
pending until the poll sees it complete: if the poll stops, for a
timeout or an interrupt, the model stays pending on the new fit, and
wait_for_fit() resumes the wait.
ValueError
If the data or the estimator’s parameters are invalid,
or the data exceeds the model limits.
FitFailedError
If the server reports that the fit failed while
fit() polled for it. The model is then unfitted.
FittedModelNotFoundError
If the server no longer has the fit
while fit() polls for it. The model is then unfitted.
TimeoutError
If a fit that fit() polls for has not completed
within TABPFN_CLIENT_ASYNC_POLL_TIMEOUT seconds. The model is
then pending on the new fit.
TabPFNRegressor.predict
View source X.
Once the server has accepted the prediction, it replaces the model’s
pending prediction, as submit_predict() does. While predict() waits
for a prediction the server runs as a background job, the model holds
it: if the wait stops, for a timeout or an interrupt, the prediction
stays pending, for wait_for_predict() to resume and save_model() to
save. A "full" output split over several requests is not held: if the
wait for it stops, the client logs the ids of the predictions still
running.
Type aliases
Type aliases
NotFittedError
If the model has no fit, or its fit is pending:
call wait_for_fit() first.
ValueError
If output_type is not one of the above, X exceeds
the model limits or the group columns are invalid.
RuntimeError
If a "full" prediction split across several requests
returns fields that cannot be combined.
PredictFailedError
If the server reports that the prediction
failed, in answer to the prediction request or to a poll for it.
Another failed request raises RuntimeError, which
PredictFailedError subclasses.
RefitRequiredError
If the fitted model can no longer predict:
call fit() again.
TimeoutError
If a prediction the server runs as a background job
has not completed within TABPFN_CLIENT_ASYNC_POLL_TIMEOUT
seconds. The model then holds it: call wait_for_predict().
TabPFNRegressor.get_timings
View source {"fit": ..., "predict": ...}:
fit:elapsed_s,queue_wait_s,train_set_transform_s,fit_s.predict:test_set_transform_queue_wait_s,test_set_transform_s,predict_queue_wait_s,predict_s. A prediction sent in several requests reports their sum.
None before the first call, while a fit is pending, on a model
restored with load_model() from a completed fit, and when the server
does not report timings.
TabPFNRegressor.last_predict_timings
View source None.
Returns
TabPFNRegressor.submit_fit
View source fit() does, but returns as
soon as the server has accepted the fit, which it then runs as a
background job, whatever api_mode is. Until wait_for_fit() sees
the fit complete, the model is pending: predict() raises
NotFittedError, and save_model() saves it as a pending fit, which
a later run can load_model() and wait for. The id of the fit is in
model_id_ as soon as submit_fit() returns, for logs or support
requests.
ValueError
If the data or the estimator’s parameters are invalid,
or the data exceeds the model limits.
TabPFNRegressor.wait_for_fit
View source submit_fit() started.
Polls the server until the fit has completed, after which the model
can predict. A model load_model() restored from a record of a pending
fit is waited for the same way. Returns at once, without a request, if
the fit has already completed.
NotFittedError
If the model has no fit to wait for.
FitFailedError
If the server reports that the fit failed. The
model is then unfitted.
FittedModelNotFoundError
If the server does not have the fit, for
instance because it was deleted. The model is then unfitted.
TimeoutError
If the fit has not completed within
TABPFN_CLIENT_ASYNC_POLL_TIMEOUT seconds. The model is still
pending, so wait_for_fit() can be called again.
RuntimeError
If polling for the fit fails 4 times in a row with
an unexpected error. The model is still pending.
TabPFNRegressor.submit_predict
View source X as predict() does, but returns as soon as the
server has accepted the prediction, which it then runs as a background
job, whatever api_mode is. wait_for_predict() waits for it and
returns the predictions. The model holds one pending prediction: a new
submit_predict() or predict() replaces it once the server has
accepted the new prediction, and a new fit drops it. save_model()
saves it, and a pickled or copied model keeps it; clone() does not.
Type aliases
Type aliases
NotFittedError
If the model has no fit, or its fit is pending:
call wait_for_fit() first.
ValueError
If output_type is not one predict() takes, X
exceeds the model limits, the group columns are invalid, or a
"full" output for X does not fit in one response.
RuntimeError
If the server does not run predictions as background
jobs.
PredictFailedError
If the server reports that the prediction
failed at once, for example because it could not queue it.
TabPFNRegressor.wait_for_predict
View source submit_predict() started, or one
predict() stopped waiting for. Polls the server until the prediction
has completed. Until then the prediction is pending, so a wait that
stops can be resumed by calling wait_for_predict() again.
RuntimeError
If no prediction is pending, polling for it fails,
or the server no longer has it. In the last case, it is then
no longer pending.
PredictFailedError
If the server reports that the prediction
failed. It is then no longer pending.
RefitRequiredError
If the fitted model can no longer predict:
call fit() again. The prediction is then no longer pending.
TimeoutError
If the prediction has not completed within
TABPFN_CLIENT_ASYNC_POLL_TIMEOUT seconds.
Scikit-learn scoring
Inheritedscore(X, y, sample_weight=None) calls predict and returns the coefficient of determination (R²).