{
  "cells": [
    {
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "source": [
        "%matplotlib inline"
      ],
      "cell_type": "code",
      "outputs": []
    },
    {
      "metadata": {},
      "source": [
        "\n# Example\n\n\nAn example of :class:`bca.BCA`\n\n"
      ],
      "cell_type": "markdown"
    },
    {
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "source": [
        "from bca import BCA\nfrom sklearn.datasets import load_breast_cancer\nfrom sklearn.naive_bayes import GaussianNB\n\n# reading the input features and class labels from the breast cancer dataset\nX, y = load_breast_cancer().data, load_breast_cancer().target\n\n# setting the main estimator (e.g., naive Bayes in this example)\nestimator = GaussianNB()\n\n# setting the feature selection class and indicating the main estimator\nselector = BCA(estimator)\n\n# fitting the estimator while performing wrapper feature selection\nselector.fit(X, y)\n\n# best selected features\nprint(selector.features) \n\n# best validation score (default is accuracy but can be set to other metrics)\nprint(selector.score)  \n\n# predict function transforms the features intrinsically and predict the class label\nprint(selector.predict(X[20:25]))"
      ],
      "cell_type": "code",
      "outputs": []
    }
  ],
  "nbformat": 4,
  "metadata": {
    "language_info": {
      "file_extension": ".py",
      "nbconvert_exporter": "python",
      "mimetype": "text/x-python",
      "version": "3.5.2",
      "name": "python",
      "codemirror_mode": {
        "version": 3,
        "name": "ipython"
      },
      "pygments_lexer": "ipython3"
    },
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    }
  },
  "nbformat_minor": 0
}