{ "cells": [ { "cell_type": "code", "execution_count": 14, "id": "443692c0", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "from sklearn.metrics import accuracy_score" ] }, { "cell_type": "code", "execution_count": 34, "id": "77be6d6c", "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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
0
0hello
1help
2request
3affirm
4request
......
586null
587request
588null
589ack
590hello
\n", "

591 rows × 1 columns

\n", "
" ], "text/plain": [ " 0\n", "0 hello\n", "1 help\n", "2 request\n", "3 affirm\n", "4 request\n", ".. ...\n", "586 null\n", "587 request\n", "588 null\n", "589 ack\n", "590 hello\n", "\n", "[591 rows x 1 columns]" ] }, "execution_count": 34, "metadata": {}, "output_type": "execute_result" } ], "source": [ "expected = pd.read_csv('evaluate.tsv', sep='\\t', header=None)\n", "expected = expected.fillna('null')\n", "expected" ] }, { "cell_type": "code", "execution_count": 38, "id": "b77d4102", "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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
0
0hello
1help
2request
3affirm
4request
......
586null
587request
588null
589ack
590hello
\n", "

591 rows × 1 columns

\n", "
" ], "text/plain": [ " 0\n", "0 hello\n", "1 help\n", "2 request\n", "3 affirm\n", "4 request\n", ".. ...\n", "586 null\n", "587 request\n", "588 null\n", "589 ack\n", "590 hello\n", "\n", "[591 rows x 1 columns]" ] }, "execution_count": 38, "metadata": {}, "output_type": "execute_result" } ], "source": [ "predicted = pd.read_csv('predicted.tsv', sep='\\t', header=None)\n", "predicted = predicted.fillna('null')\n", "predicted" ] }, { "cell_type": "code", "execution_count": 39, "id": "79ecc70a", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "1.0\n" ] } ], "source": [ "print(accuracy_score(expected, predicted))" ] } ], "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.10.2" } }, "nbformat": 4, "nbformat_minor": 5 }