{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "4cd1da0e", "metadata": {}, "outputs": [], "source": [ "%load_ext autoreload\n", "%autoreload 2\n", "import pandas as pd\n", "import numpy as np\n", "import seaborn as sns\n", "import matplotlib.pyplot as plt\n", "from synthetic_task.plot_results import load_comp_grad_results_metrics, plot_comp_grad_metrics_vs_iter_by_ydim" ] }, { "cell_type": "code", "execution_count": 2, "id": "6f2b2dea", "metadata": {}, "outputs": [], "source": [ "sns.set_theme(style=\"whitegrid\", context=\"talk\")\n", "palette = sns.color_palette()" ] }, { "cell_type": "code", "execution_count": 3, "id": "d24a0bbc", "metadata": {}, "outputs": [], "source": [ "batch_size = 8\n", "COMP_GRAD_DIR = f\"../synthetic_results_compare_grad_{batch_size}\"\n", "\n", "METHODS = [\n", " \"ffocp_eq\",\n", "]\n", "METHODS_LEGEND = {\n", " \"ffocp_eq\": \"FFOCP\",\n", "}\n", "\n", "method_order = [METHODS_LEGEND[m] for m in METHODS]\n", "\n", "METHODS_STEPS = [method+\"_steps\" for method in METHODS]\n", "\n", "df = load_comp_grad_results_metrics(\n", " base_dir=COMP_GRAD_DIR,\n", " methods=METHODS_STEPS,\n", " methods_legend=METHODS_LEGEND,\n", " parse_backwardTol=True,\n", ")\n", "\n", "df[\"method\"] = pd.Categorical(df[\"method\"], categories=method_order, ordered=True)\n" ] }, { "cell_type": "code", "execution_count": 4, "id": "af45fabd", "metadata": {}, "outputs": [], "source": [ "markers = [\"o\", \"s\", \"D\", \"^\", \"v\", \"x\", \"P\", \"s\"]\n", "markers_dict = {m: markers[i] for i, m in enumerate(method_order)}\n", "plot_comp_grad_metrics_vs_iter_by_ydim(\n", " df,\n", " plot_path=COMP_GRAD_DIR,\n", " plot_name_tag=\"grad\",\n", " filter_method=\"FFOCP\",\n", " filter_backwardTol=1e-5,\n", " cosine_ylim=(0.5, 1.0),\n", " legend_ncol=4,\n", ")\n", "\n", "# if this not work, try decrease lr." ] }, { "cell_type": "code", "execution_count": null, "id": "3cb8e08c", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "4128687f", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "rl", "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.14" } }, "nbformat": 4, "nbformat_minor": 5 }