File size: 2,712 Bytes
f977fd5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "c2352e4c",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"from utils.compute_tools import make_normalizer, load_normalizer"
]
},
{
"cell_type": "markdown",
"id": "0a3a5a5e",
"metadata": {},
"source": [
"## 1. normalization with max-min from your own results"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e95b280a",
"metadata": {},
"outputs": [],
"source": [
"#read results from csv file\n",
"results = pd.read_csv(f\"examples/results_and_parameters.csv\")\n",
"\n",
"benchmark_name=\"your_benchmark_name\" #set your desired benchmark_name\n",
"metric = \"test metric\" #column containing test metrics in csv file\n",
"make_normalizer(\n",
" results, \n",
" metrics=(metric,), \n",
" benchmark_name=benchmark_name\n",
" )\n",
"\n",
"#normalize results\n",
"normalizer = load_normalizer(benchmark_name=benchmark_name)\n",
"new_metric = normalizer.normalize_data_frame(df=results, metric=metric)\n",
"\n",
"#save normalized values to file\n",
"results.to_csv(\"examples/normalized_results_and_parameters.csv\")"
]
},
{
"cell_type": "markdown",
"id": "7d3f1e10",
"metadata": {},
"source": [
"## 2. normalization with max-min from leaderboard base results"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "07a21745",
"metadata": {},
"outputs": [],
"source": [
"#read results from csv file\n",
"results = pd.read_csv(f\"examples/results_and_parameters.csv\")\n",
"\n",
"metric = \"test metric\" #column containing test metrics in csv file\n",
"make_normalizer(\n",
" results, \n",
" metrics=(metric,), \n",
" # benchmark_name=benchmark_name\n",
" )\n",
"\n",
"#normalize results\n",
"normalizer = load_normalizer() #leave benchmark name blank to use default leaderboard normalization values\n",
"new_metric = normalizer.normalize_data_frame(df=results, metric=metric)\n",
"\n",
"#save normalized values to file\n",
"results.to_csv(\"examples/normalized_results_and_parameters.csv\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
|