{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.96\n"
     ]
    }
   ],
   "source": [
    "#!/usr/bin/python\n",
    "\n",
    "\"\"\" \n",
    "PLEASE NOTE:\n",
    "The api of train_test_split changed and moved from sklearn.cross_validation to\n",
    "sklearn.model_selection(version update from 0.17 to 0.18)\n",
    "\n",
    "The correct documentation for this quiz is here: \n",
    "http://scikit-learn.org/0.17/modules/cross_validation.html\n",
    "\"\"\"\n",
    "\n",
    "from sklearn import datasets\n",
    "from sklearn.svm import SVC\n",
    "\n",
    "iris = datasets.load_iris()\n",
    "features = iris.data\n",
    "labels = iris.target\n",
    "\n",
    "###############################################################\n",
    "### YOUR CODE HERE\n",
    "###############################################################\n",
    "\n",
    "### import the relevant code and make your train/test split\n",
    "### name the output datasets features_train, features_test,\n",
    "### labels_train, and labels_test\n",
    "# PLEASE NOTE: The import here changes depending on your version of sklearn\n",
    "#from sklearn import cross_validation # for version 0.17\n",
    "# For version 0.18\n",
    "from sklearn.model_selection import train_test_split\n",
    "\n",
    "\n",
    "### set the random_state to 0 and the test_size to 0.4 so\n",
    "### we can exactly check your result\n",
    "features_train, features_test, labels_train, labels_test = train_test_split(features, labels, test_size = 0.33,random_state=41)\n",
    "\n",
    "###############################################################\n",
    "# DONT CHANGE ANYTHING HERE\n",
    "clf = SVC(kernel=\"linear\", C=1.)\n",
    "clf.fit(features_train, labels_train)\n",
    "\n",
    "print (clf.score(features_test, labels_test))\n",
    "##############################################################\n",
    "def submitAcc():\n",
    "    return clf.score(features_test, labels_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "150 150\n",
      "100 100\n"
     ]
    }
   ],
   "source": [
    "print(len(features),len(labels))\n",
    "print(len(features_train),len(labels_train))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "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.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
