{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "%matplotlib inline"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# IPLS - Basic example\n\nAn Interval Partial Least Squares example showing the optimal interval of specified size for the regression of synthetic\ndata.\n\nThe example uses a synthetic dataset with 50 standard normally distributed features.\nThe target values only depend on two features: #21 and #24.\nIf the VIP method is tasked with selecting an interval of width 5, it identifies\nan interval containing the features #21 and #24\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import matplotlib.pyplot as plt\nimport numpy as np\n\nfrom auswahl import IPLS\n\nnp.random.seed(1337)\nX = np.random.randn(100, 50)\ny = 5 * X[:, 21] - 2 * X[:, 24]\n\nipls = IPLS(interval_width=5)\nipls.fit(X, y)\n\nplt.bar(x=np.arange(X.shape[1]), height=ipls.get_support())\n\nplt.xlabel('Feature')\nplt.ylabel('Selection weight')\n\nplt.show()"
      ]
    }
  ],
  "metadata": {
    "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.8.13"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}