{ "cells": [ { "cell_type": "markdown", "id": "dc3852ca", "metadata": {}, "source": [ "# Evaluate Classification" ] }, { "cell_type": "markdown", "id": "3a2d9fbf", "metadata": {}, "source": [ "## Setup" ] }, { "cell_type": "markdown", "id": "45140c6e", "metadata": {}, "source": [ "#### Load the API key and libaries." ] }, { "cell_type": "code", "execution_count": 1, "id": "e7bf1b8e", "metadata": { "height": 115, "tags": [] }, "outputs": [], "source": [ "from src.Language_Evaluation_LC import llm_language_evaluation\n", "from src.data_analysis import run_analysis\n", "import pandas as pd" ] }, { "cell_type": "markdown", "id": "10e95383", "metadata": { "height": 30 }, "source": [ "#### Load the Constants" ] }, { "cell_type": "code", "execution_count": 2, "id": "464a2aaa", "metadata": { "height": 47, "tags": [] }, "outputs": [], "source": [ "\n", "MODEL = \"meta-llama/Llama-3-70b-chat-hf\"\n", "TEMPERATURE = 0.0\n", "N_REPETITIONS = 0\n", "REASONING = False\n", "LANGUAGES = ['spanish', 'tagalog', 'portuguese', 'english']" ] }, { "cell_type": "markdown", "id": "92663014", "metadata": {}, "source": [ "#### Run The Experiments:" ] }, { "cell_type": "code", "execution_count": 1, "id": "7c7ccfa1", "metadata": { "tags": [] }, "outputs": [], "source": [ "# Run evaluation:\n", "llm_language_evaluation(path=PATH, model=MODEL, temperature=TEMPERATURE, n_repetitions=N_REPETITIONS, reasoning=REASONING, languages=LANGUAGES)" ] }, { "cell_type": "markdown", "id": "079dcbc4", "metadata": {}, "source": [ "#### See the results" ] }, { "cell_type": "code", "execution_count": 2, "id": "a58184aa", "metadata": { "height": 30, "tags": [] }, "outputs": [], "source": [ "import os\n", "MODEL = os.path.basename(MODEL)\n", "\n", "if N_REPETITIONS > 1:\n", " df = pd.read_csv(f\"responses/{MODEL}_Temperature{str(TEMPERATURE).replace('.', '_')}_{N_REPETITIONS}Repetitions.csv\")\n", "else:\n", " df = pd.read_csv(f\"responses/{MODEL}_Temperature{str(TEMPERATURE).replace('.', '_')}.csv\")\n", "\n", "df" ] }, { "cell_type": "markdown", "id": "041dc525", "metadata": {}, "source": [ "### Data Analysis" ] }, { "cell_type": "code", "execution_count": 3, "id": "85f6bb97", "metadata": { "tags": [] }, "outputs": [], "source": [ "TEMPERATURE = str(TEMPERATURE).replace('.', '_')\n", "\n", "run_analysis(model=MODEL, temperature=TEMPERATURE, n_repetitions=N_REPETITIONS, languages=LANGUAGES)" ] }, { "cell_type": "code", "execution_count": 4, "id": "dffeddc1", "metadata": { "tags": [] }, "outputs": [], "source": [ "N_REPETITIONS = 1 if N_REPETITIONS < 1 else N_REPETITIONS\n", "pd.read_csv(f'results/results_{MODEL}_Temperature{TEMPERATURE}_Repetitions{N_REPETITIONS}/matches_results_{MODEL}.csv')" ] }, { "cell_type": "code", "execution_count": 5, "id": "c23866b3-c0c6-42de-968c-6994b2b8b7fa", "metadata": {}, "outputs": [], "source": [ "pd.read_csv(f'results/results_{MODEL}_Temperature{TEMPERATURE}_Repetitions{N_REPETITIONS}/matches_results_{MODEL}.csv').sum()" ] }, { "cell_type": "code", "execution_count": null, "id": "1dcad7d6-7647-49c5-9804-17db4dfbc5a3", "metadata": {}, "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.7" } }, "nbformat": 4, "nbformat_minor": 5 }