From d2cedc1e0ec4b22d644804d056f60f78030d737f Mon Sep 17 00:00:00 2001 From: Milton Pividori Date: Tue, 5 Sep 2023 01:50:06 -0600 Subject: [PATCH] add notebook to check pvalue distribution --- nbs/25_pvalue/00-ccc_pvalue_dist.ipynb | 427 +++++++++++++++++++++++++ nbs/25_pvalue/py/00-ccc_pvalue_dist.py | 69 ++++ 2 files changed, 496 insertions(+) create mode 100644 nbs/25_pvalue/00-ccc_pvalue_dist.ipynb create mode 100644 nbs/25_pvalue/py/00-ccc_pvalue_dist.py diff --git a/nbs/25_pvalue/00-ccc_pvalue_dist.ipynb b/nbs/25_pvalue/00-ccc_pvalue_dist.ipynb new file mode 100644 index 00000000..5d80328a --- /dev/null +++ b/nbs/25_pvalue/00-ccc_pvalue_dist.ipynb @@ -0,0 +1,427 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "ec52faa3-656f-483e-9617-d7ec0f7d818c", + "metadata": { + "papermill": { + "duration": 0.003068, + "end_time": "2023-09-05T07:37:27.955837", + "exception": false, + "start_time": "2023-09-05T07:37:27.952769", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "# Description" + ] + }, + { + "cell_type": "markdown", + "id": "51102f42-fcd9-4a58-9c8d-dfcd3d2d464e", + "metadata": { + "papermill": { + "duration": 0.002343, + "end_time": "2023-09-05T07:37:27.968715", + "exception": false, + "start_time": "2023-09-05T07:37:27.966372", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "Tests whether the distribution of pvalues generated by CCC is the expected one (uniform)." + ] + }, + { + "cell_type": "markdown", + "id": "7006ceeb-2651-407d-bfa1-1039727649ef", + "metadata": { + "papermill": { + "duration": 0.002323, + "end_time": "2023-09-05T07:37:27.973524", + "exception": false, + "start_time": "2023-09-05T07:37:27.971201", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "# Modules loading" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "1ffa1a96-7545-40b9-ac8b-8627e13de8d4", + "metadata": { + "execution": { + "iopub.execute_input": "2023-09-05T07:37:27.979350Z", + "iopub.status.busy": "2023-09-05T07:37:27.979148Z", + "iopub.status.idle": "2023-09-05T07:37:28.727834Z", + "shell.execute_reply": "2023-09-05T07:37:28.727328Z" + }, + "papermill": { + "duration": 0.753618, + "end_time": "2023-09-05T07:37:28.729601", + "exception": false, + "start_time": "2023-09-05T07:37:27.975983", + "status": "completed" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "import numpy as np\n", + "import matplotlib.pyplot as plt\n", + "import seaborn as sns\n", + "from scipy import stats\n", + "\n", + "from ccc.coef import ccc" + ] + }, + { + "cell_type": "markdown", + "id": "0d3cc810-4b17-4213-8f03-6fe7e97a0fe3", + "metadata": { + "papermill": { + "duration": 0.010291, + "end_time": "2023-09-05T07:37:28.742736", + "exception": false, + "start_time": "2023-09-05T07:37:28.732445", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "# Generate random data" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "472ff1df-b4f6-417f-b396-58a55ce0e39a", + "metadata": { + "execution": { + "iopub.execute_input": "2023-09-05T07:37:28.748301Z", + "iopub.status.busy": "2023-09-05T07:37:28.748209Z", + "iopub.status.idle": "2023-09-05T07:37:28.750838Z", + "shell.execute_reply": "2023-09-05T07:37:28.750489Z" + }, + "papermill": { + "duration": 0.006782, + "end_time": "2023-09-05T07:37:28.752055", + "exception": false, + "start_time": "2023-09-05T07:37:28.745273", + "status": "completed" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "data = np.random.rand(100, 1000)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "acd7a9c0-d8a8-46f5-ab60-2478347adf36", + "metadata": { + "execution": { + "iopub.execute_input": "2023-09-05T07:37:28.758674Z", + "iopub.status.busy": "2023-09-05T07:37:28.758591Z", + "iopub.status.idle": "2023-09-05T07:37:28.762434Z", + "shell.execute_reply": "2023-09-05T07:37:28.762098Z" + }, + "papermill": { + "duration": 0.009477, + "end_time": "2023-09-05T07:37:28.764102", + "exception": false, + "start_time": "2023-09-05T07:37:28.754625", + "status": "completed" + }, + "tags": [] + }, + "outputs": [ + { + "data": { + "text/plain": [ + "(100, 1000)" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "data.shape" + ] + }, + { + "cell_type": "markdown", + "id": "7c24b674-edde-4b83-817d-c7f10729cdc8", + "metadata": { + "papermill": { + "duration": 0.002588, + "end_time": "2023-09-05T07:37:28.769908", + "exception": false, + "start_time": "2023-09-05T07:37:28.767320", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "# Run CCC" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "5513799a-a239-4c66-ba6f-88290caf4484", + "metadata": { + "execution": { + "iopub.execute_input": "2023-09-05T07:37:28.775785Z", + "iopub.status.busy": "2023-09-05T07:37:28.775687Z", + "iopub.status.idle": "2023-09-05T09:47:53.811926Z", + "shell.execute_reply": "2023-09-05T09:47:53.811411Z" + }, + "papermill": { + "duration": 7825.040968, + "end_time": "2023-09-05T09:47:53.813585", + "exception": false, + "start_time": "2023-09-05T07:37:28.772617", + "status": "completed" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "res = ccc(data, n_jobs=20, pvalue_n_perms=1000, use_ari_numba=True)" + ] + }, + { + "cell_type": "markdown", + "id": "d25a59fa-a22b-41e0-84a3-74414ddaad23", + "metadata": { + "papermill": { + "duration": 0.010299, + "end_time": "2023-09-05T09:47:53.827026", + "exception": false, + "start_time": "2023-09-05T09:47:53.816727", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "# Plots" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "615d9e99-d2d7-4cce-8517-32907a236b27", + "metadata": { + "execution": { + "iopub.execute_input": "2023-09-05T09:47:53.833975Z", + "iopub.status.busy": "2023-09-05T09:47:53.833809Z", + "iopub.status.idle": "2023-09-05T09:47:53.941806Z", + "shell.execute_reply": "2023-09-05T09:47:53.941490Z" + }, + "papermill": { + "duration": 0.113327, + "end_time": "2023-09-05T09:47:53.943247", + "exception": false, + "start_time": "2023-09-05T09:47:53.829920", + "status": "completed" + }, + "tags": [] + }, + "outputs": [ + { + "data": { + "text/plain": [ + "Text(0, 0.5, 'Frequency')" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEWCAYAAACJ0YulAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAY2klEQVR4nO3debRdZZ3m8e9jQAaZKwFjIARsVIKtlga0Wy0H7GIoFbVEYylGRNElWtpaXYBSDl2VLuzucmqLRaPlIkALgoqgq7REbBzKAYOCTFJE0BATIeDAII0Gf/3H2dkekntzz03uPif35vtZ666z97uH83vvTc5z3r332SdVhSRJAA8bdQGSpK2HoSBJahkKkqSWoSBJahkKkqSWoSBJahkKGqkkZyb5myna1/wk9yaZ1cxfkeR1U7HvZn9fTLJkqvY3ief9uyR3Jvn5FO/3NUm+OZX71PRnKKgzSX6S5P4k9yT5VZJvJXljkvbfXVW9sar+dsB9PW9T61TVyqrapaoenILa35vkvA32f1RVLdvSfU+yjv2AdwALq+qRGyybl2RdkkePsd3FSf7nsOrUzGEoqGsvqKpdgf2B04GTgX+a6idJst1U73MrsT9wV1XdseGCqvoZcDlwXH97kr2Ao4GhBphmBkNBQ1FVv66qS4GXA0uSPB4gydlJ/q6Znp3kC82o4hdJvpHkYUnOBeYDn28OD/11kgVJKskJSVYCX+1r6w+IRye5Msmvk1zSvGCS5NlJVvXXuH40kuRI4J3Ay5vnu6ZZ3h6Oauo6LclPk9yR5JwkuzfL1texJMnK5tDPu8b73STZvdl+bbO/05r9Pw+4DHhUU8fZY2y+jA1CAVgMXF9V1yY5JcmPm9HaDUlePE4NG/3uNjz8luS1SW5M8ssk/5Jk/6Y9ST7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aZ9Pbkxyc5GH0vuRnvS8Db14/k+RJHZQtTZqhIA3ufHrfR3BBVV0D/AC4nl5Q/Os425wCfIHed0P339L4L4FFzZet3wC8sbOqpUnwLqmSpJYjBUlSy1CQJLUMBUlSy1CQJLUMBUlSy1CQJLUMBUlS6/8D3pR73044RO0AAAAASUVORK5CYII=\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], + "source": [ + "plt.hist(res[1], bins=10, edgecolor=\"k\") # Adjust the number of bins as needed\n", + "plt.title(\"Distribution of Values\")\n", + "plt.xlabel(\"Value\")\n", + "plt.ylabel(\"Frequency\")" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "37a85073-a287-48e6-adc6-f86808f15111", + "metadata": { + "execution": { + "iopub.execute_input": "2023-09-05T09:47:53.957397Z", + "iopub.status.busy": "2023-09-05T09:47:53.957308Z", + "iopub.status.idle": "2023-09-05T09:47:54.050477Z", + "shell.execute_reply": "2023-09-05T09:47:54.049947Z" + }, + "papermill": { + "duration": 0.105293, + "end_time": "2023-09-05T09:47:54.051767", + "exception": false, + "start_time": "2023-09-05T09:47:53.946474", + "status": "completed" + }, + "tags": [] + }, + "outputs": [ + { + "data": { + "text/plain": [ + "Text(0, 0.5, 'Density')" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEWCAYAAACJ0YulAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAApfElEQVR4nO3de5xVdb3/8deHq6Byk5FgBhhATKEEExFDlNIU7aJdLKzUzKSL2vV4wk6/o3biZKe0U+fkKTWPmOWltNQOmUp5IUWFQhCQi4IwgDCIoGIiMJ/fH5+1N1ucYfbM7LUvM+/n47Efe8+6ftbMnvV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i+nHFupFPz81d6TQj7DZrS3oTXyOh4zOwK4HjjV3V8sUmxpyeeYxwG3JgmhP3Came1y998XJcLCy/e7vdndtwPbzexhYAxQqUkhn2M+D7jSo8J9pZmtAg4DnihOiEVX8PNXe68+ymfYjLuBc5JW/AnANnffUOxAC6jZYzazIcCdwNkVfNWYq9ljdvdh7l7r7rXAb4EvVXBCgPy+23cBk8ysi5n1BI4BlhY5zkLK55jXECUjzGwAMZLyc0WNsrgKfv5q1yUFb2LYDDP7QjL/Z0RPlNOAlcBrxJVGxcrzmP8VOAi4Jrly3uUVPMJknsfcruRzzO6+1MzuBRYCDcD17t5o18ZKkOff+d+AG81sEVG18k13r9ghtc3sFmAy0N/M6oDLgK6Q3vlLw1yIiEhWe68+EhGRFlBSEBGRLCUFERHJUlIQEZEsJQUREclSUhBpRjJMxCl7TfuqmV2zj+UrtouvdGxKCiLNu4W4USrX1GS6SLuipCDSvN8CHzCz7gBmVgsMAj5pZvOScfuvaGxFM3s15/PHzOzG5HOVmd1hZk8mr4mpH4VIHpQURJqRjA31BDAlmTQVuA34l+RO8COAE5LxpPL1Y+BH7n408FFiHCqRkmvXw1yIFFCmCumu5P2zwMfNbBrxfzQQGEUMKZGPk4BROSO29jKzA939lYJGLdJCSgoi+fk9cHXyuMMewEvAPwFHu/tLSbXQfo2slzuOTO78TsCx7v6PdMIVaR1VH4nkwd1fBR4EbiBKDb2A7cC2ZDTOU5tYdaOZHW5mnYiH/GTcB1yU+cHMxqYQtkiLKSmI5O8W4nkEt7r7U8DfgcVEovhrE+tMB/5APBs6d0jjLwPjkoetLwG+kFrUIi2gUVJFRCRLJQUREclSUhARkSwlBRERyVJSEBGRLCUFERHJUlIQEZEsJQUREcn6//GE8LGTpxSvAAAAAElFTkSuQmCC\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], + "source": [ + "sns.histplot(res[1], kde=True, color=\"blue\")\n", + "plt.title(\"Distribution of Values\")\n", + "plt.xlabel(\"Value\")\n", + "plt.ylabel(\"Density\")" + ] + }, + { + "cell_type": "markdown", + "id": "5417f0e8-47f6-46c2-a6f8-20151b027e67", + "metadata": { + "papermill": { + "duration": 0.003324, + "end_time": "2023-09-05T09:47:54.058742", + "exception": false, + "start_time": "2023-09-05T09:47:54.055418", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "# KS" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "abf1ab0c-3528-4942-b6b0-f96c944f629c", + "metadata": { + "execution": { + "iopub.execute_input": "2023-09-05T09:47:54.066710Z", + "iopub.status.busy": "2023-09-05T09:47:54.066596Z", + "iopub.status.idle": "2023-09-05T09:47:54.070465Z", + "shell.execute_reply": "2023-09-05T09:47:54.070054Z" + }, + "papermill": { + "duration": 0.009253, + "end_time": "2023-09-05T09:47:54.071610", + "exception": false, + "start_time": "2023-09-05T09:47:54.062357", + "status": "completed" + }, + "tags": [] + }, + "outputs": [ + { + "data": { + "text/plain": [ + "KstestResult(statistic=0.017040737040737053, pvalue=0.11155111928549677)" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "stats.ks_1samp(res[1], stats.uniform.cdf)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8717c138-7fb9-4cc4-bba4-4fe5adeac802", + "metadata": { + "papermill": { + "duration": 0.003436, + "end_time": "2023-09-05T09:47:54.078738", + "exception": false, + "start_time": "2023-09-05T09:47:54.075302", + "status": "completed" + }, + "tags": [] + }, + "outputs": [], + "source": [] + } + ], + "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.12" + }, + "papermill": { + "default_parameters": {}, + "duration": 7827.528961, + "end_time": "2023-09-05T09:47:54.507084", + "environment_variables": {}, + "exception": null, + "input_path": "nbs/25_pvalue/00-ccc_pvalue_dist.ipynb", + "output_path": "nbs/25_pvalue/00-ccc_pvalue_dist.run.ipynb", + "parameters": {}, + "start_time": "2023-09-05T07:37:26.978123", + "version": "2.3.4" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/nbs/25_pvalue/py/00-ccc_pvalue_dist.py b/nbs/25_pvalue/py/00-ccc_pvalue_dist.py new file mode 100644 index 00000000..a333ee01 --- /dev/null +++ b/nbs/25_pvalue/py/00-ccc_pvalue_dist.py @@ -0,0 +1,69 @@ +# --- +# jupyter: +# jupytext: +# cell_metadata_filter: all,-execution,-papermill,-trusted +# text_representation: +# extension: .py +# format_name: percent +# format_version: '1.3' +# jupytext_version: 1.11.5 +# kernelspec: +# display_name: Python 3 (ipykernel) +# language: python +# name: python3 +# --- + +# %% [markdown] tags=[] +# # Description + +# %% [markdown] tags=[] +# Tests whether the distribution of pvalues generated by CCC is the expected one (uniform). + +# %% [markdown] tags=[] +# # Modules loading + +# %% tags=[] +import numpy as np +import matplotlib.pyplot as plt +import seaborn as sns +from scipy import stats + +from ccc.coef import ccc + +# %% [markdown] tags=[] +# # Generate random data + +# %% tags=[] +data = np.random.rand(100, 1000) + +# %% tags=[] +data.shape + +# %% [markdown] tags=[] +# # Run CCC + +# %% tags=[] +res = ccc(data, n_jobs=20, pvalue_n_perms=1000, use_ari_numba=True) + +# %% [markdown] tags=[] +# # Plots + +# %% tags=[] +plt.hist(res[1], bins=10, edgecolor="k") # Adjust the number of bins as needed +plt.title("Distribution of Values") +plt.xlabel("Value") +plt.ylabel("Frequency") + +# %% tags=[] +sns.histplot(res[1], kde=True, color="blue") +plt.title("Distribution of Values") +plt.xlabel("Value") +plt.ylabel("Density") + +# %% [markdown] tags=[] +# # KS + +# %% tags=[] +stats.ks_1samp(res[1], stats.uniform.cdf) + +# %% tags=[]