{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "c13267cf",
   "metadata": {
    "papermill": {
     "duration": 0.002192,
     "end_time": "2024-11-05T12:54:42.346219",
     "exception": false,
     "start_time": "2024-11-05T12:54:42.344027",
     "status": "completed"
    },
    "tags": []
   },
   "source": [
    "## Feature Extraction Process\n",
    "\n",
    "To apply feature extraction, use the `train_FE` dataset that you preprocessed in the data transformation stage.\n",
    "\n",
    "###  Prepare Continuous Features DataFrame\n",
    "Create a DataFrame named `train_FE_scaled_continuous` that includes all continuous features from `train_FE_scaled`.\n",
    "\n",
    "### Step 1: Perform Principal Component Analysis (PCA)\n",
    "\n",
    "#### 1.1 Plot Pearson Correlation Heatmap\n",
    "- Generate a Pearson correlation heatmap to identify groups of features that are correlated. Use this to investigate which features are correlated together, as these can inform PCA component selection.\n",
    "\n",
    "#### 1.2 Apply PCA and Assess Eigenvalues\n",
    "- Apply a PCA method to `train_FE_scaled_continuous`.\n",
    "- Examine eigenvalues and the explained variance ratio.\n",
    "- Select components with eigenvalues greater than 1, adjust `n_components` accordingly, and run a new PCA model with this setting.\n",
    "\n",
    "#### 1.3 Interpret Components\n",
    "- Describe each component based on the weights of features it comprises. This helps clarify the influence of each feature within its component.\n",
    "\n",
    "#### 1.4 Plot Pairplot with Selected Components\n",
    "- Create a pairplot using the selected PCA components and the target field (`IsBadBuy`). This visualizes the relationship between components and the target.\n",
    "\n",
    "#### 1.5 Save Results\n",
    "- Save the resulting dataset as `train_pca_fe`, including the extracted PCA components and fields from `train_FE_scaled` except for the continuous features.\n",
    "\n",
    "\n",
    "### Step 2: Perform Linear Discriminant Analysis (LDA)\n",
    "\n",
    "#### 2.1 Apply LDA   \n",
    "- Apply the LDA method to `train_FE_scaled_continuous`. This will extract linear discriminant component based on the target variable (`IsBadBuy`).\n",
    "\n",
    "#### 2.2 Plot Pairplot \n",
    "- Create a pairplot using the extracted linear discriminant components and the target field (`IsBadBuy`). This visualizes the relationship between the component and the target.\n",
    "\n",
    "#### 2.3 Save Results\n",
    "- Save the resulting dataset as `train_lda_fe`, including the extracted LDA components and all fields from `train_FE_scaled` except the continuous features."
   ]
  }
 ],
 "metadata": {
  "kaggle": {
   "accelerator": "none",
   "dataSources": [],
   "dockerImageVersionId": 30786,
   "isGpuEnabled": false,
   "isInternetEnabled": true,
   "language": "python",
   "sourceType": "notebook"
  },
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.14"
  },
  "papermill": {
   "default_parameters": {},
   "duration": 3.569046,
   "end_time": "2024-11-05T12:54:42.769939",
   "environment_variables": {},
   "exception": null,
   "input_path": "__notebook__.ipynb",
   "output_path": "__notebook__.ipynb",
   "parameters": {},
   "start_time": "2024-11-05T12:54:39.200893",
   "version": "2.6.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
