Skip to content

Commit 14dd2ff

Browse files
committed
Update ensemble_predictions_fixed.ipynb
1 parent 1558935 commit 14dd2ff

File tree

1 file changed

+80
-3
lines changed

1 file changed

+80
-3
lines changed

clipnet_evaluation/ensemble_predictions_fixed.ipynb

Lines changed: 80 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
},
2626
{
2727
"cell_type": "code",
28-
"execution_count": 3,
28+
"execution_count": 37,
2929
"metadata": {},
3030
"outputs": [],
3131
"source": [
@@ -34,7 +34,7 @@
3434
"import pandas as pd\n",
3535
"import os\n",
3636
"import seaborn as sns\n",
37-
"from scipy.stats import pearsonr\n",
37+
"from scipy.stats import pearsonr, spearmanr\n",
3838
"\n",
3939
"from matplotlib.colors import LinearSegmentedColormap\n",
4040
"import mpl_scatter_density # needed for density scatter plots\n",
@@ -94,7 +94,7 @@
9494
},
9595
{
9696
"cell_type": "code",
97-
"execution_count": 8,
97+
"execution_count": 17,
9898
"metadata": {},
9999
"outputs": [],
100100
"source": [
@@ -239,6 +239,76 @@
239239
"plt.savefig(\"img/ensemble_predictions_pearson_cdf.pdf\")"
240240
]
241241
},
242+
{
243+
"cell_type": "code",
244+
"execution_count": 20,
245+
"metadata": {},
246+
"outputs": [],
247+
"source": [
248+
"log_sums.index = log_sums.index % int(log_sums.shape[0] / 67)"
249+
]
250+
},
251+
{
252+
"cell_type": "code",
253+
"execution_count": 24,
254+
"metadata": {},
255+
"outputs": [
256+
{
257+
"data": {
258+
"text/plain": [
259+
"PearsonRResult(statistic=0.6686770636128865, pvalue=0.0)"
260+
]
261+
},
262+
"execution_count": 24,
263+
"metadata": {},
264+
"output_type": "execute_result"
265+
}
266+
],
267+
"source": [
268+
"pearsonr(log_sums.groupby(level=0).mean().pred, log_sums.groupby(level=0).mean().expt)"
269+
]
270+
},
271+
{
272+
"cell_type": "code",
273+
"execution_count": 44,
274+
"metadata": {},
275+
"outputs": [],
276+
"source": [
277+
"individual_pearsons = pd.Series(\n",
278+
" [\n",
279+
" pearsonr(log_sums.iloc[4901 * i:4901 * (i + 1), :][\"pred\"], log_sums.iloc[4901 * i:4901 * (i + 1), :][\"expt\"])[0]\n",
280+
" for i in range(67)\n",
281+
" ]\n",
282+
")\n",
283+
"\n",
284+
"individual_spearmans = pd.Series(\n",
285+
" [\n",
286+
" spearmanr(log_sums.iloc[4901 * i:4901 * (i + 1), :][\"pred\"], log_sums.iloc[4901 * i:4901 * (i + 1), :][\"expt\"])[0]\n",
287+
" for i in range(67)\n",
288+
" ]\n",
289+
")"
290+
]
291+
},
292+
{
293+
"cell_type": "code",
294+
"execution_count": 49,
295+
"metadata": {},
296+
"outputs": [
297+
{
298+
"data": {
299+
"text/plain": [
300+
"0.6509504629274192"
301+
]
302+
},
303+
"execution_count": 49,
304+
"metadata": {},
305+
"output_type": "execute_result"
306+
}
307+
],
308+
"source": [
309+
"individual_pearsons.median()"
310+
]
311+
},
242312
{
243313
"cell_type": "code",
244314
"execution_count": 76,
@@ -295,6 +365,13 @@
295365
"pearsonr(log_sums[\"pred\"], log_sums[\"expt\"])"
296366
]
297367
},
368+
{
369+
"cell_type": "code",
370+
"execution_count": null,
371+
"metadata": {},
372+
"outputs": [],
373+
"source": []
374+
},
298375
{
299376
"cell_type": "code",
300377
"execution_count": 78,

0 commit comments

Comments
 (0)