{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "%load_ext autoreload\n", "%autoreload 2" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import json\n", "import os\n", "from utils import *" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "selected_latent_space = valid_latent_spaces[\n", " str(input(\"Enter latent space - one of \" + str(list(valid_latent_spaces.keys()))))\n", "]\n", "\n", "selected_feature_model = valid_feature_models[\n", " str(input(\"Enter feature model - one of \" + str(list(valid_feature_models.keys()))))\n", "]\n", "\n", "k = int(input(\"Enter value of k: \"))\n", "if k < 1:\n", " raise ValueError(\"k should be a positive integer\")\n", "\n", "selected_dim_reduction_method = str(\n", " input(\n", " \"Enter dimensionality reduction method - one of \"\n", " + str(list(valid_dim_reduction_methods.keys()))\n", " )\n", ")\n", "\n", "label = int(input(\"Enter label: \"))\n", "if label < 0 and label > 100:\n", " raise ValueError(\"k should be between 0 and 100\")\n", "\n", "\n", "match selected_latent_space:\n", " case \"\":\n", " if os.path.exists(f\"{selected_feature_model}-{selected_dim_reduction_method}-{k}-semantics.json\"):\n", " data = json.load(open(f\"{selected_feature_model}-{selected_dim_reduction_method}-{k}-semantics.json\"))\n", " else:\n", " print(f\"{selected_feature_model}-{selected_dim_reduction_method}-{k}-semantics.json does not exist\" )\n", " case \"cp\":\n", " if os.path.exists(f\"{selected_feature_model}-cp-{k}-semantics.json\"):\n", " data = json.load(open(f\"{selected_feature_model}-cp-{k}-semantics.json\"))\n", " else:\n", " \n", " print(f\"{selected_feature_model}-cp-{k}-semantics.json does not exist\" )\n", " case _:\n", " if os.path.exists(f\"{selected_latent_space}-{selected_feature_model}-{selected_dim_reduction_method}-{k}-semantics.json\"):\n", " data = json.load(open(f\"{selected_latent_space}-{selected_feature_model}-{selected_dim_reduction_method}-{k}-semantics.json\"))\n", " else:\n", " print(f\"{selected_latent_space}-{selected_feature_model}-{selected_dim_reduction_method}-{k}-semantics.json does not exist\" )\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "(101, 10)\n", "(10, 10)\n", "(10, 101)\n" ] } ], "source": [ "match selected_latent_space:\n", "\n", " case \"label_sim\":\n", "\n", " extract_simila\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "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.11.4" } }, "nbformat": 4, "nbformat_minor": 2 }