{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "10d8e4fe-11be-478a-bc33-a81bb0dce987",
   "metadata": {},
   "source": [
    "# Multi Class\n",
    "\n",
    "You can also allow each image to belong to multiple categories with the `multiclass` argument."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d7aa1379-5cbd-4284-8d99-373bfd02c807",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "# If in a notebook:\n",
    "%matplotlib ipympl"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d7db1d50-2fe0-4fa5-9af9-1f0753acd34d",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "\n",
    "from mpl_image_labeller import image_labeller\n",
    "\n",
    "images = np.random.randn(5, 10, 10)\n",
    "labeller = image_labeller(\n",
    "    images,\n",
    "    classes=[\"good\", \"bad\", \"meh\"],\n",
    "    label_keymap=[\"a\", \"s\", \"d\"],\n",
    "    multiclass=True,\n",
    ")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4471612b-e5f7-4a55-8232-536da875fb29",
   "metadata": {},
   "source": [
    "The natural representation of this multiclass is a onehot encoding accessible (and settable!) via the `labels_onehot` property."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b724f277-2eb9-4d5c-b0a7-0820ce4b20d2",
   "metadata": {},
   "outputs": [],
   "source": [
    "print(labeller.labels_onehot)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2cf1e17e-8a18-4a56-b9d8-4be61fe4bd47",
   "metadata": {},
   "source": [
    "If you can you can also get the labels as a ragged list of lists via the `labels` property"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "700dcf86-7337-4b50-aab0-ddd7346a24d9",
   "metadata": {},
   "outputs": [],
   "source": [
    "print(labeller.labels)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "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.9.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
