{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# CoxKAN Introductory Demo" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "from coxkan import CoxKAN\n", "from sklearn.model_selection import train_test_split\n", "import numpy as np" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Synthetic Dataset Example\n", "\n", "The code below generates a synthetic survival dataset under the hazard function\n", "\n", "$$\\text{Hazard, } h(t, \\mathbf{x}) = 0.01 e^{\\theta(\\mathbf{x})},$$\n", "\n", "where\n", "\n", "$$\\text{Log-Partial Hazard, }\\theta (\\mathbf{x}) = \\tanh (5x_1) + \\sin (2 \\pi x_2)$$\n", "\n", "and a **uniform censoring distribution**." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Concordance index of true expression: 0.7524\n" ] }, { "data": { "text/html": [ "
| \n", " | x1 | \n", "x2 | \n", "duration | \n", "event | \n", "
|---|---|---|---|---|
| 9254 | \n", "0.541629 | \n", "-0.706251 | \n", "42.270669 | \n", "1 | \n", "
| 1561 | \n", "-0.526259 | \n", "-0.492606 | \n", "54.283488 | \n", "1 | \n", "
| 1670 | \n", "-0.238753 | \n", "-0.326589 | \n", "361.569903 | \n", "1 | \n", "
| 6087 | \n", "-0.588024 | \n", "0.742029 | \n", "57.335278 | \n", "0 | \n", "
| 6669 | \n", "-0.739364 | \n", "-0.302907 | \n", "95.975668 | \n", "1 | \n", "