{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "uckzrua411f",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.datasets import load_breast_cancer\n",
    "\n",
    "from lizyml_widget import LizyWidget\n",
    "\n",
    "data = load_breast_cancer(as_frame=True)\n",
    "df = data.frame\n",
    "\n",
    "w = LizyWidget()\n",
    "w.load(df, target=\"target\")\n",
    "\n",
    "# Set 3 custom metrics including precision_at_k with k=20\n",
    "w.set_config(\n",
    "    {\n",
    "        \"model\": {\n",
    "            \"name\": \"lgbm\",\n",
    "            \"params\": {\n",
    "                \"n_estimators\": 50,\n",
    "                \"learning_rate\": 0.1,\n",
    "                \"metric\": [\"auc\", \"binary_logloss\", \"precision_at_k\"],\n",
    "                \"_precision_at_k_k\": 20,\n",
    "            },\n",
    "        },\n",
    "        \"training\": {\n",
    "            \"seed\": 42,\n",
    "            \"early_stopping\": {\"enabled\": True, \"rounds\": 10},\n",
    "        },\n",
    "    }\n",
    ")\n",
    "\n",
    "w.fit()\n",
    "w"
   ]
  }
 ],
 "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.11.14"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}