{ "cells": [ { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "# Tutorial 8: Machine Learning with `SQuADDS`\n", "\n", "In this tutorial, we will walk you through how to use SQuADDS to create ML interpolation solutions.\n" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "%load_ext autoreload\n", "%autoreload 2" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Collecting Training Data from `SQuADDS`" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For this tutorial, we will be trying to predict the design space variables of a qubit-cavity system." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "from squadds import SQuADDS_DB, Analyzer\n", "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "faa412c5f85648bc902136c3051f9d6e", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Downloading readme: 0%| | 0.00/2.75k [00:00, ?B/s]" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "7d7f386ad2d84939b6d037e7e3bbb5a0", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Generating train split: 0 examples [00:00, ? examples/s]" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "5c790bec4d3344afa9bed7886f13d937", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Generating train split: 0 examples [00:00, ? examples/s]" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "db = SQuADDS_DB()\n", "db.select_system([\"qubit\",\"cavity_claw\"])\n", "db.select_qubit(\"TransmonCross\")\n", "db.select_cavity_claw(\"RouteMeander\")\n", "db.select_resonator_type(\"quarter\")\n", "merged_df = db.create_system_df()\n", "analyzer = Analyzer(db)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Recall that we need all Hamiltonian parameters to generate a **complete** training dataset. For this tutorial, I have chosen some demo targets to generate the training data. " ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "application/vnd.microsoft.datawrangler.viewer.v0+json": { "columns": [ { "name": "index", "rawType": "int64", "type": "integer" }, { "name": "cavity_frequency_GHz", "rawType": "float64", "type": "float" }, { "name": "kappa_kHz", "rawType": "float64", "type": "float" }, { "name": "g_MHz", "rawType": "float64", "type": "float" }, { "name": "anharmonicity_MHz", "rawType": "float64", "type": "float" }, { "name": "res_type", "rawType": "object", "type": "string" }, { "name": "qubit_frequency_GHz", "rawType": "float64", "type": "float" } ], "conversionMethod": "pd.DataFrame", "ref": "a87b18d8-5d11-436b-bec5-76dd84f4dc5a", "rows": [ [ "0", "6.920734896896145", "163.433944837535", "102.19926994459972", "-194.2640307393007", "quarter", "4.621651307671222" ], [ "1", "6.468747291501403", "127.17554343521748", "67.94706033609594", "-288.0564182287747", "quarter", "5.51426188889122" ], [ "2", "6.9652970551745", "35.66624465794003", "73.16276829805271", "-235.3469213665384", "quarter", "5.0396440327797976" ], [ "3", "5.806680939937274", "153.07440157973", "90.69893535287324", "-160.93351403161665", "quarter", "4.241134087736324" ], [ "4", "5.88943923388279", "97.82350420477", "84.70219676438194", "-219.0688566879674", "quarter", "4.879756149472431" ], [ "5", "5.762118781658918", "211.778480040625", "69.2413724269554", "-280.3048353791549", "quarter", "5.448083761840355" ] ], "shape": { "columns": 6, "rows": 6 } }, "text/html": [ "
\n", " | cavity_frequency_GHz | \n", "kappa_kHz | \n", "g_MHz | \n", "anharmonicity_MHz | \n", "res_type | \n", "qubit_frequency_GHz | \n", "
---|---|---|---|---|---|---|
0 | \n", "6.920735 | \n", "163.433945 | \n", "102.199270 | \n", "-194.264031 | \n", "quarter | \n", "4.621651 | \n", "
1 | \n", "6.468747 | \n", "127.175543 | \n", "67.947060 | \n", "-288.056418 | \n", "quarter | \n", "5.514262 | \n", "
2 | \n", "6.965297 | \n", "35.666245 | \n", "73.162768 | \n", "-235.346921 | \n", "quarter | \n", "5.039644 | \n", "
3 | \n", "5.806681 | \n", "153.074402 | \n", "90.698935 | \n", "-160.933514 | \n", "quarter | \n", "4.241134 | \n", "
4 | \n", "5.889439 | \n", "97.823504 | \n", "84.702197 | \n", "-219.068857 | \n", "quarter | \n", "4.879756 | \n", "
5 | \n", "5.762119 | \n", "211.778480 | \n", "69.241372 | \n", "-280.304835 | \n", "quarter | \n", "5.448084 | \n", "
\n", " | claw_length | \n", "cavity_frequency_GHz | \n", "kappa_kHz | \n", "EC | \n", "EJ | \n", "qubit_frequency_GHz | \n", "anharmonicity_MHz | \n", "g_MHz | \n", "cross_length | \n", "cross_gap | \n", "ground_spacing | \n", "coupling_length | \n", "total_length | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "160.0 | \n", "8.963333 | \n", "282.985474 | \n", "0.119465 | \n", "16.346243 | \n", "3.829124 | \n", "-128.92902 | \n", "52.250558 | \n", "310.0 | \n", "30.0 | \n", "10.0 | \n", "200.0 | \n", "2700.0 | \n", "
1 | \n", "160.0 | \n", "6.911806 | \n", "689.394209 | \n", "0.119465 | \n", "16.346243 | \n", "3.829124 | \n", "-128.92902 | \n", "40.291451 | \n", "310.0 | \n", "30.0 | \n", "10.0 | \n", "500.0 | \n", "3400.0 | \n", "
2 | \n", "160.0 | \n", "8.968642 | \n", "205.609615 | \n", "0.119465 | \n", "16.346243 | \n", "3.829124 | \n", "-128.92902 | \n", "52.281505 | \n", "310.0 | \n", "30.0 | \n", "10.0 | \n", "200.0 | \n", "2700.0 | \n", "
3 | \n", "160.0 | \n", "6.767688 | \n", "36.337103 | \n", "0.119465 | \n", "16.346243 | \n", "3.829124 | \n", "-128.92902 | \n", "39.451337 | \n", "310.0 | \n", "30.0 | \n", "10.0 | \n", "100.0 | \n", "3900.0 | \n", "
4 | \n", "160.0 | \n", "6.576639 | \n", "136.678808 | \n", "0.119465 | \n", "16.346243 | \n", "3.829124 | \n", "-128.92902 | \n", "38.337641 | \n", "310.0 | \n", "30.0 | \n", "10.0 | \n", "230.0 | \n", "3900.0 | \n", "
\n", " | qubit_frequency_GHz | \n", "cavity_frequency_GHz | \n", "anharmonicity_MHz | \n", "kappa_kHz | \n", "g_MHz | \n", "
---|---|---|---|---|---|
0 | \n", "4.621651 | \n", "6.920735 | \n", "-194.264031 | \n", "163.433945 | \n", "102.199270 | \n", "
1 | \n", "5.514262 | \n", "6.468747 | \n", "-288.056418 | \n", "127.175543 | \n", "67.947060 | \n", "
2 | \n", "5.039644 | \n", "6.965297 | \n", "-235.346921 | \n", "35.666245 | \n", "73.162768 | \n", "
3 | \n", "4.241134 | \n", "5.806681 | \n", "-160.933514 | \n", "153.074402 | \n", "90.698935 | \n", "
4 | \n", "4.879756 | \n", "5.889439 | \n", "-219.068857 | \n", "97.823504 | \n", "84.702197 | \n", "
5 | \n", "5.448084 | \n", "5.762119 | \n", "-280.304835 | \n", "211.778480 | \n", "69.241372 | \n", "
\n", " | coupler_type | \n", "design_options_qubit | \n", "design_options_cavity_claw | \n", "setup_qubit | \n", "setup_cavity_claw | \n", "design_options | \n", "
---|---|---|---|---|---|---|
0 | \n", "CLT | \n", "{'aedt_hfss_capacitance': 0, 'aedt_hfss_induct... | \n", "{'claw_opts': {'connection_pads': {'readout': ... | \n", "{'auto_increase_solution_order': True, 'enable... | \n", "{'basis_order': 1, 'max_delta_f': 0.05, 'max_p... | \n", "{'cavity_claw_options': {'coupler_type': 'CLT'... | \n", "
1 | \n", "CLT | \n", "{'aedt_hfss_capacitance': 0, 'aedt_hfss_induct... | \n", "{'claw_opts': {'connection_pads': {'readout': ... | \n", "{'auto_increase_solution_order': True, 'enable... | \n", "{'basis_order': 1, 'max_delta_f': 0.05, 'max_p... | \n", "{'cavity_claw_options': {'coupler_type': 'CLT'... | \n", "
2 | \n", "CLT | \n", "{'aedt_hfss_capacitance': 0, 'aedt_hfss_induct... | \n", "{'claw_opts': {'connection_pads': {'readout': ... | \n", "{'auto_increase_solution_order': True, 'enable... | \n", "{'basis_order': 1, 'max_delta_f': 0.05, 'max_p... | \n", "{'cavity_claw_options': {'coupler_type': 'CLT'... | \n", "
3 | \n", "CLT | \n", "{'aedt_hfss_capacitance': 0, 'aedt_hfss_induct... | \n", "{'claw_opts': {'connection_pads': {'readout': ... | \n", "{'auto_increase_solution_order': True, 'enable... | \n", "{'basis_order': 1, 'max_delta_f': 0.05, 'max_p... | \n", "{'cavity_claw_options': {'coupler_type': 'CLT'... | \n", "
4 | \n", "CLT | \n", "{'aedt_hfss_capacitance': 0, 'aedt_hfss_induct... | \n", "{'claw_opts': {'connection_pads': {'readout': ... | \n", "{'auto_increase_solution_order': True, 'enable... | \n", "{'basis_order': 1, 'max_delta_f': 0.05, 'max_p... | \n", "{'cavity_claw_options': {'coupler_type': 'CLT'... | \n", "
5 | \n", "CLT | \n", "{'aedt_hfss_capacitance': 0, 'aedt_hfss_induct... | \n", "{'claw_opts': {'connection_pads': {'readout': ... | \n", "{'auto_increase_solution_order': True, 'enable... | \n", "{'basis_order': 1, 'max_delta_f': 0.05, 'max_p... | \n", "{'cavity_claw_options': {'coupler_type': 'CLT'... | \n", "
Developed by Sadman Ahmed Shanto
\n", "This tutorial is written by Sadman Ahmed Shanto
\n", "© Copyright Sadman Ahmed Shanto & Eli Levenson-Falk 2025.
\n", "This code is licensed under the MIT License. You may
obtain a copy of this license in the LICENSE.txt file in the root directory
of this source tree.
Any modifications or derivative works of this code must retain this
copyright notice, and modified files need to carry a notice indicating
that they have been altered from the originals.