{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "a467e3ba-8d17-41a7-bedd-978a258ce3c4",
   "metadata": {},
   "outputs": [],
   "source": [
    "import json"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "2f06565e-3ea3-497b-84f3-8b02974866dc",
   "metadata": {},
   "outputs": [],
   "source": [
    "fd=open(\"../results/best_results_accuracy_STree.json\")\n",
    "fo=open(\"../results/best_results_accuracy_BaggingStree.json\", \"w\")\n",
    "data=json.load(fd)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "53ed3731-3a41-4fc9-8a4e-f6fb67898d69",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'C': 10000.0,\n",
       " 'gamma': 0.1,\n",
       " 'kernel': 'rbf',\n",
       " 'max_iter': 10000.0,\n",
       " 'multiclass_strategy': 'ovr'}"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data['balance-scale'][1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "9711dd21-f14e-4df8-896f-bbbdb726aab6",
   "metadata": {},
   "outputs": [],
   "source": [
    "for key, value in data.items():\n",
    "    value[0]=0.0\n",
    "    value[2]=\"-program made-\"\n",
    "    res = {\"n_estimators\": 100}\n",
    "    for key2, value2 in value[1].items():\n",
    "        res[f\"base_estimator__{key2}\"] = value2\n",
    "    value[1] = res\n",
    "json.dump(data, fo)\n",
    "fd.close()\n",
    "fo.close()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "0359e663-8938-472f-b5b5-fc6a555feeaf",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'{\"n_estimators\": 100, \"base_estimator__C\": 0.1, \"base_estimator__max_iter\": 10000.0, \"base_estimator__kernel\": \"liblinear\", \"base_estimator__multiclass_strategy\": \"ovr\"}'"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "json.dumps(res)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "e5fb06aa-40ec-41a3-b9b2-bdeb228aa4f9",
   "metadata": {},
   "outputs": [],
   "source": [
    "fo=open(\"../results/best_results_accuracy_BaggingStree.json\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "b6d7f629-c0ca-49b8-ba9f-209794eae18e",
   "metadata": {},
   "outputs": [],
   "source": [
    "data=json.load(fo)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "20598416-68bf-4b59-b855-60f7776d8774",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'balance-scale': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__C': 10000.0,\n",
       "   'base_estimator__gamma': 0.1,\n",
       "   'base_estimator__kernel': 'rbf',\n",
       "   'base_estimator__max_iter': 10000.0,\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'balloons': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__C': 7,\n",
       "   'base_estimator__gamma': 0.1,\n",
       "   'base_estimator__kernel': 'rbf',\n",
       "   'base_estimator__max_iter': 10000.0,\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'breast-cancer-wisc-diag': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__C': 0.2,\n",
       "   'base_estimator__max_iter': 10000.0,\n",
       "   'base_estimator__kernel': 'liblinear',\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'breast-cancer-wisc-prog': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__C': 0.2,\n",
       "   'base_estimator__max_iter': 10000.0,\n",
       "   'base_estimator__kernel': 'liblinear',\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'breast-cancer-wisc': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__kernel': 'rbf',\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'breast-cancer': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__kernel': 'liblinear',\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'cardiotocography-10clases': [0.0, {'n_estimators': 100}, '-program made-'],\n",
       " 'cardiotocography-3clases': [0.0, {'n_estimators': 100}, '-program made-'],\n",
       " 'conn-bench-sonar-mines-rocks': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__kernel': 'rbf',\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'cylinder-bands': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__kernel': 'rbf',\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'dermatology': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__C': 55,\n",
       "   'base_estimator__max_iter': 10000.0,\n",
       "   'base_estimator__kernel': 'liblinear',\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'echocardiogram': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__splitter': 'random',\n",
       "   'base_estimator__max_features': 'auto'},\n",
       "  '-program made-'],\n",
       " 'fertility': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__C': 0.05,\n",
       "   'base_estimator__max_features': 'auto',\n",
       "   'base_estimator__max_iter': 10000.0,\n",
       "   'base_estimator__kernel': 'liblinear',\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'haberman-survival': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__kernel': 'liblinear',\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'heart-hungarian': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__C': 0.05,\n",
       "   'base_estimator__max_iter': 10000.0,\n",
       "   'base_estimator__kernel': 'liblinear',\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'hepatitis': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__C': 7,\n",
       "   'base_estimator__gamma': 0.1,\n",
       "   'base_estimator__kernel': 'rbf',\n",
       "   'base_estimator__max_iter': 10000.0,\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'ilpd-indian-liver': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__kernel': 'liblinear',\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'ionosphere': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__C': 7,\n",
       "   'base_estimator__gamma': 0.1,\n",
       "   'base_estimator__kernel': 'rbf',\n",
       "   'base_estimator__max_iter': 10000.0,\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'iris': [0.0, {'n_estimators': 100}, '-program made-'],\n",
       " 'led-display': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__kernel': 'liblinear',\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'libras': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__C': 0.08,\n",
       "   'base_estimator__max_iter': 10000.0,\n",
       "   'base_estimator__kernel': 'liblinear',\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'low-res-spect': [0.0, {'n_estimators': 100}, '-program made-'],\n",
       " 'lymphography': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__C': 0.05,\n",
       "   'base_estimator__max_iter': 10000.0,\n",
       "   'base_estimator__kernel': 'liblinear',\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'mammographic': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__kernel': 'rbf',\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'molec-biol-promoter': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__kernel': 'rbf',\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'musk-1': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__C': 0.05,\n",
       "   'base_estimator__gamma': 0.1,\n",
       "   'base_estimator__kernel': 'poly',\n",
       "   'base_estimator__max_iter': 10000.0,\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'oocytes_merluccius_nucleus_4d': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__C': 8.25,\n",
       "   'base_estimator__gamma': 0.1,\n",
       "   'base_estimator__kernel': 'poly',\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'oocytes_merluccius_states_2f': [0.0,\n",
       "  {'n_estimators': 100},\n",
       "  '-program made-'],\n",
       " 'oocytes_trisopterus_nucleus_2f': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__kernel': 'liblinear',\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'oocytes_trisopterus_states_5b': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__C': 0.11,\n",
       "   'base_estimator__max_iter': 10000.0,\n",
       "   'base_estimator__kernel': 'liblinear',\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'parkinsons': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__kernel': 'liblinear',\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'pima': [0.0, {'n_estimators': 100}, '-program made-'],\n",
       " 'pittsburg-bridges-MATERIAL': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__C': 7,\n",
       "   'base_estimator__gamma': 0.1,\n",
       "   'base_estimator__kernel': 'rbf',\n",
       "   'base_estimator__max_iter': 10000.0,\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'pittsburg-bridges-REL-L': [0.0, {'n_estimators': 100}, '-program made-'],\n",
       " 'pittsburg-bridges-SPAN': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__C': 0.05,\n",
       "   'base_estimator__max_iter': 10000.0,\n",
       "   'base_estimator__kernel': 'liblinear',\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'pittsburg-bridges-T-OR-D': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__splitter': 'random',\n",
       "   'base_estimator__max_features': 'auto'},\n",
       "  '-program made-'],\n",
       " 'planning': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__C': 7,\n",
       "   'base_estimator__gamma': 10.0,\n",
       "   'base_estimator__kernel': 'rbf',\n",
       "   'base_estimator__max_iter': 10000.0,\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'post-operative': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__C': 55,\n",
       "   'base_estimator__degree': 5,\n",
       "   'base_estimator__gamma': 0.1,\n",
       "   'base_estimator__kernel': 'poly',\n",
       "   'base_estimator__max_iter': 10000.0,\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'seeds': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__C': 10000.0,\n",
       "   'base_estimator__max_iter': 10000.0,\n",
       "   'base_estimator__kernel': 'liblinear',\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'statlog-australian-credit': [0.0, {'n_estimators': 100}, '-program made-'],\n",
       " 'statlog-german-credit': [0.0, {'n_estimators': 100}, '-program made-'],\n",
       " 'statlog-heart': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__kernel': 'liblinear',\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'statlog-image': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__C': 7,\n",
       "   'base_estimator__max_iter': 10000.0,\n",
       "   'base_estimator__kernel': 'liblinear',\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'statlog-vehicle': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__kernel': 'liblinear',\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'synthetic-control': [0.0, {'n_estimators': 100}, '-program made-'],\n",
       " 'tic-tac-toe': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__C': 0.2,\n",
       "   'base_estimator__gamma': 0.1,\n",
       "   'base_estimator__kernel': 'poly',\n",
       "   'base_estimator__max_iter': 10000.0,\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'vertebral-column-2clases': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__kernel': 'liblinear',\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'wine': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__C': 0.55,\n",
       "   'base_estimator__max_iter': 10000.0,\n",
       "   'base_estimator__kernel': 'liblinear',\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-'],\n",
       " 'zoo': [0.0,\n",
       "  {'n_estimators': 100,\n",
       "   'base_estimator__C': 0.1,\n",
       "   'base_estimator__max_iter': 10000.0,\n",
       "   'base_estimator__kernel': 'liblinear',\n",
       "   'base_estimator__multiclass_strategy': 'ovr'},\n",
       "  '-program made-']}"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data"
   ]
  }
 ],
 "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.9.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
