Format: application/octet-stream
⬇ Download File (1.9 KB)
   1  {
   2   "cells": [
   3    {
   4     "cell_type": "code",
   5     "execution_count": 3,
   6     "id": "cb7731e2",
   7     "metadata": {},
   8     "outputs": [
   9      {
  10       "name": "stdout",
  11       "output_type": "stream",
  12       "text": [
  13        "0 178\n",
  14        "1 182\n",
  15        "2 177\n",
  16        "3 183\n",
  17        "4 181\n",
  18        "5 182\n",
  19        "6 181\n",
  20        "7 179\n",
  21        "8 174\n",
  22        "9 180\n",
  23        "[178 182 177 183 181 182 181 179 174 180]\n"
  24       ]
  25      }
  26     ],
  27     "source": [
  28      "%matplotlib notebook\n",
  29      "import numpy as np\n",
  30      "import pandas as pd\n",
  31      "import seaborn as sns\n",
  32      "import matplotlib.pyplot as plt\n",
  33      "from sklearn.model_selection import train_test_split\n",
  34      "from sklearn.datasets import load_digits\n",
  35      "\n",
  36      "dataset = load_digits()\n",
  37      "X, y = dataset.data, dataset.target\n",
  38      "\n",
  39      "for class_name, class_count in zip(dataset.target_names, np.bincount(dataset.target)):\n",
  40      "    print(class_name,class_count)\n",
  41      "    \n",
  42      "print(np.bincount(dataset.target))"
  43     ]
  44    },
  45    {
  46     "cell_type": "code",
  47     "execution_count": 5,
  48     "id": "8631b0a3",
  49     "metadata": {},
  50     "outputs": [
  51      {
  52       "data": {
  53        "text/plain": [
  54         "1797"
  55        ]
  56       },
  57       "execution_count": 5,
  58       "metadata": {},
  59       "output_type": "execute_result"
  60      }
  61     ],
  62     "source": [
  63      "len(dataset.target)"
  64     ]
  65    },
  66    {
  67     "cell_type": "code",
  68     "execution_count": null,
  69     "id": "3207328b",
  70     "metadata": {},
  71     "outputs": [],
  72     "source": []
  73    }
  74   ],
  75   "metadata": {
  76    "kernelspec": {
  77     "display_name": "Python 3",
  78     "language": "python",
  79     "name": "python3"
  80    },
  81    "language_info": {
  82     "codemirror_mode": {
  83      "name": "ipython",
  84      "version": 3
  85     },
  86     "file_extension": ".py",
  87     "mimetype": "text/x-python",
  88     "name": "python",
  89     "nbconvert_exporter": "python",
  90     "pygments_lexer": "ipython3",
  91     "version": "3.8.8"
  92    }
  93   },
  94   "nbformat": 4,
  95   "nbformat_minor": 5
  96  }
  97