diff --git a/changelog/978.changed.md b/changelog/978.changed.md new file mode 100644 index 000000000..b2ede5206 --- /dev/null +++ b/changelog/978.changed.md @@ -0,0 +1 @@ +Remove the feature selection cell from the TabPFN_Demo_Local example notebook. diff --git a/examples/notebooks/TabPFN_Demo_Local.ipynb b/examples/notebooks/TabPFN_Demo_Local.ipynb index 404606614..c2b1a30b9 100644 --- a/examples/notebooks/TabPFN_Demo_Local.ipynb +++ b/examples/notebooks/TabPFN_Demo_Local.ipynb @@ -3177,56 +3177,6 @@ " plt.show()" ] }, - { - "cell_type": "markdown", - "metadata": { - "id": "PkphS4vSFNvg" - }, - "source": [ - "### Feature selection\n", - "\n", - "Feature selection is the process of selecting a subset of relevant features for use in model construction. It's useful for reducing model complexity, improving performance by removing noise, and decreasing training time. Here, we'll use Sequential Forward Selection (SFS), which starts with no features and iteratively adds the feature that most improves the model's performance.\n", - "\n", - "The goal is to see if we can create a simpler, faster model with fewer features without a significant drop in accuracy.\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "id": "GPJtNDLnFPPW" - }, - "outputs": [], - "source": [ - "from tabpfn_extensions import interpretability\n", - "\n", - "# Load data\n", - "data = load_breast_cancer()\n", - "X, y = data.data, data.target\n", - "feature_names = data.feature_names\n", - "\n", - "# Initialize model\n", - "clf = TabPFNClassifier(n_estimators=1)\n", - "\n", - "# Feature selection\n", - "sfs = interpretability.feature_selection.feature_selection(\n", - " estimator=clf,\n", - " X=X,\n", - " y=y,\n", - " n_features_to_select=4,\n", - " feature_names=feature_names,\n", - " cv=3,\n", - ")\n", - "\n", - "# Print selected features\n", - "selected_features = [\n", - " feature_names[i] for i in range(len(feature_names)) if sfs.get_support()[i]\n", - "]\n", - "print(\"\\nSelected features:\")\n", - "for feature in selected_features:\n", - " print(f\"- {feature}\")" - ] - }, { "cell_type": "markdown", "metadata": {