skills/tabular/tabpfn-small-dataset-ensemble/SKILL.md
Ensembles TabPFN (a prior-fitted Bayesian transformer for small tabular data) with XGBoost, averaging probabilities for stronger predictions on datasets under 1000 rows.
npx skillsauth add wenmin-wu/ds-skills tabular-tabpfn-small-dataset-ensembleInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
TabPFN is a transformer pre-trained on millions of synthetic tabular datasets — it performs Bayesian inference in a single forward pass without gradient-based training. On datasets with <1000 rows and <100 features, it matches or beats tuned XGBoost. But it has blind spots (feature interactions, specific distributions) where XGBoost excels. Ensembling both via probability averaging combines TabPFN's strong prior with XGBoost's flexibility, consistently outperforming either model alone on small-data competitions.
import numpy as np
import xgboost
from tabpfn import TabPFNClassifier
from sklearn.impute import SimpleImputer
from sklearn.base import BaseEstimator
class TabPFNXGBEnsemble(BaseEstimator):
def __init__(self):
self.imputer = SimpleImputer(strategy='median')
self.classifiers = [
xgboost.XGBClassifier(n_estimators=100, max_depth=3,
learning_rate=0.2, subsample=0.9),
TabPFNClassifier(N_ensemble_configurations=24),
TabPFNClassifier(N_ensemble_configurations=64),
]
def fit(self, X, y):
X = self.imputer.fit_transform(X)
unique, y_enc = np.unique(y, return_inverse=True)
self.classes_ = unique
for clf in self.classifiers:
clf.fit(X, y_enc)
return self
def predict_proba(self, X):
X = self.imputer.transform(X)
probs = [clf.predict_proba(X) for clf in self.classifiers]
return np.mean(probs, axis=0)
model = TabPFNXGBEnsemble()
model.fit(X_train, y_train)
preds = model.predict_proba(X_test)
data-ai
Scaled Pinball Loss (SPL) metric for evaluating quantile forecasts, normalized by mean absolute successive differences of training data
data-ai
Walk backward through a time series and multiplicatively rescale segments when jumps exceed a fraction of the running mean to correct data collection anomalies
testing
Transform forecasting target to next/current ratio minus one so that optimizing MAE or squared error implicitly minimizes SMAPE
tools
Convert point forecasts to prediction intervals by scaling with logit-transformed quantile ratios passed through a Normal CDF