{ "cells": [ { "cell_type": "markdown", "id": "8537cbba", "metadata": {}, "source": [ "# Evaluate Classification" ] }, { "cell_type": "markdown", "id": "99b70284", "metadata": {}, "source": [ "## Setup" ] }, { "cell_type": "markdown", "id": "96d4d092", "metadata": {}, "source": [ "#### Load the Model and libaries." ] }, { "cell_type": "code", "execution_count": 1, "id": "dd695375", "metadata": { "height": 115 }, "outputs": [], "source": [ "from src.Language_Evaluation import llm_language_evaluation\n", "from src.data_analysis import run_analysis\n", "import pandas as pd" ] }, { "cell_type": "markdown", "id": "cbd2b8af", "metadata": { "height": 30 }, "source": [ "#### Load the Constants" ] }, { "cell_type": "code", "execution_count": 2, "id": "ac659e2f", "metadata": { "height": 47 }, "outputs": [], "source": [ "PATH = 'DATA PATH'\n", "MODEL = \"Llama-2-13b\"\n", "TEMPERATURE = 0\n", "N_REPETITIONS = 0\n", "REASONING = False\n", "LANGUAGES = ['spanish', 'tagalog', 'portuguese', 'english']" ] }, { "cell_type": "markdown", "id": "137bfc14", "metadata": {}, "source": [ "#### Run The Experiments:" ] }, { "cell_type": "code", "execution_count": null, "id": "7cf6751b", "metadata": {}, "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": "edde4ac2", "metadata": {}, "source": [ "#### See the results" ] }, { "cell_type": "code", "execution_count": null, "id": "8eef88dd", "metadata": { "height": 30 }, "outputs": [], "source": [ "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": "d9b8f898", "metadata": {}, "source": [ "### Data Analysis" ] }, { "cell_type": "code", "execution_count": null, "id": "5e74454b", "metadata": {}, "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": null, "id": "939ee357", "metadata": {}, "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": null, "id": "59dc2a52", "metadata": {}, "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_by_theme_{MODEL}.csv')" ] }, { "cell_type": "code", "execution_count": null, "id": "807f6fba", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python [conda env:nlp_bias_vpython=3_8_15]", "language": "python", "name": "conda-env-nlp_bias_vpython_3_8_15-py" }, "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.8.15" } }, "nbformat": 4, "nbformat_minor": 5 }