{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "41a252ff",
   "metadata": {},
   "outputs": [],
   "source": [
    "import rootcause as rc\n",
    "\n",
    "rc.login()\n",
    "twin = rc.workspace(\"App Showcase\").twin(\"Churn Twin\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "7512bc60",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "17a6ca416bc1489d98f85609b49c8c22",
       "version_major": 2,
       "version_minor": 1
      },
      "text/plain": [
       "<rootcause.jupyter._widget_class.<locals>.RootCauseApp object at 0x0000017EF89F3620>"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "twin.console()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "cde0c4bb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "97cb72a8127a482886854451e519a3e4",
       "version_major": 2,
       "version_minor": 1
      },
      "text/plain": [
       "<rootcause.jupyter._widget_class.<locals>.RootCauseApp object at 0x0000017EFA4B8EC0>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "twin.sankey(\"Churn\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "de785e47",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "7677f8255e6749489b2bcfc333d77887",
       "version_major": 2,
       "version_minor": 1
      },
      "text/plain": [
       "<rootcause.jupyter._widget_class.<locals>.RootCauseApp object at 0x0000017EFA4B8980>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "twin.review()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "c6f58361",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "51e00e40ac3044d3808060506bdc89fb",
       "version_major": 2,
       "version_minor": 1
      },
      "text/plain": [
       "<rootcause.jupyter._widget_class.<locals>.RootCauseApp object at 0x0000017EFA1F9160>"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "twin.studio(\"What happens to churn if all month-to-month customers move to two-year contracts?\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "479c5eaf-9693-4bdd-8a3b-6017730865fa",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "twin.graph  # displayed results mount their app: the graph opens the console\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "result = twin.intervene({\"Contract\": rc.set(\"Two year\")})\n",
    "result  # the What-If Studio, mounted over the run you just paid for\n"
   ]
  }
 ],
 "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.14.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}