{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "2cd3303a", "metadata": {}, "outputs": [], "source": [ "import pickle\n", "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 2, "id": "8ccc0bc1", "metadata": {}, "outputs": [], "source": [ "with open(\"/data/yzhouc01/FILIP-MS/experiments/20251110_filip-global/result_MassSpecGym_retrieval_candidates_formula.pkl\", \"rb\") as f:\n", " result = pickle.load(f)" ] }, { "cell_type": "code", "execution_count": 3, "id": "8e517777", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
rank_finerank_globalrank_sumrank_weightedrank_avg
R@10.2145710.1633060.1928690.1912740.192869
R@50.4831400.4035660.4474250.4448620.447425
R@200.7470950.6943500.7283550.7263610.728355
\n", "
" ], "text/plain": [ " rank_fine rank_global rank_sum rank_weighted rank_avg\n", "R@1 0.214571 0.163306 0.192869 0.191274 0.192869\n", "R@5 0.483140 0.403566 0.447425 0.444862 0.447425\n", "R@20 0.747095 0.694350 0.728355 0.726361 0.728355" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data = []\n", "for i in [1, 5, 20]:\n", " curr_d = {}\n", " for c in result.columns.tolist():\n", " if c.startswith('rank'):\n", " curr_d[c] = result[result[c] <= i].shape[0] / result.shape[0]\n", " data.append(curr_d)\n", "\n", "data_df = pd.DataFrame(data, index=['R@1', 'R@5', 'R@20'])\n", "data_df\n" ] }, { "cell_type": "code", "execution_count": 7, "id": "10493857", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
rank_finerank_globalrank_sumrank_weightedrank_avg
R@10.4208820.3697310.4129070.4119390.412907
R@50.7444750.7070520.7388930.7374120.738893
R@200.9276600.9163250.9264070.9261220.926407
\n", "
" ], "text/plain": [ " rank_fine rank_global rank_sum rank_weighted rank_avg\n", "R@1 0.420882 0.369731 0.412907 0.411939 0.412907\n", "R@5 0.744475 0.707052 0.738893 0.737412 0.738893\n", "R@20 0.927660 0.916325 0.926407 0.926122 0.926407" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data = []\n", "for i in [1, 5, 20]:\n", " curr_d = {}\n", " for c in result.columns.tolist():\n", " if c.startswith('rank'):\n", " curr_d[c] = result[result[c] <= i].shape[0] / result.shape[0]\n", " data.append(curr_d)\n", "\n", "data_df = pd.DataFrame(data, index=['R@1', 'R@5', 'R@20'])\n", "data_df\n" ] }, { "cell_type": "code", "execution_count": null, "id": "1e4201db", "metadata": {}, "outputs": [], "source": [ "x" ] } ], "metadata": { "kernelspec": { "display_name": "spec", "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.7" } }, "nbformat": 4, "nbformat_minor": 5 }