diff --git a/examples/tutorial 2 - Machine-Learning with the Quantum EvolutionKernel.ipynb b/examples/tutorial 2 - Machine-Learning with the Quantum EvolutionKernel.ipynb index 9e2d1a6..dc3a0bc 100644 --- a/examples/tutorial 2 - Machine-Learning with the Quantum EvolutionKernel.ipynb +++ b/examples/tutorial 2 - Machine-Learning with the Quantum EvolutionKernel.ipynb @@ -137,14 +137,47 @@ "$$\n", "\n", "\n", - "where $\\mu$ is an hyperparameter of our kernel and $JS$ is the Jensen-Shannon divergence.\n", - " " + "where $\\mu$ is an hyperparameter of our kernel and $JS$ is the Jensen-Shannon divergence. For processing raw graph data, the IntegratedQEK is recommended; however, it requires an extractor to be provided as an argument." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "05964cf6-d96d-42ee-9b1e-707110d55917", + "metadata": {}, + "outputs": [], + "source": [ + "import qek.data.extractors as qek_extractors\n", + "import qek.data.graphs as qek_graphs\n", + "from qek.kernel import IntegratedQEK as QEK\n", + "from pathlib import Path\n", + "\n", + "# First, we need to intantiate the compiler for the type of data.\n", + "compiler = qek_graphs.PTCFMCompiler()\n", + "\n", + "# Then, instantiate the Qutip Extractor.\n", + "extractor = qek_extractors.QutipExtractor(\n", + " # Once computing is complete, data will be saved in this file.\n", + " path=Path(\"saved_data.json\"),\n", + " compiler=compiler\n", + ")\n", + "\n", + "# Finally, initialize the Integrated Quantum Evolution Kernel with both the extractor and the parameter mu.\n", + "kernel = QEK(mu=0.5, extractor=extractor)" + ] + }, + { + "cell_type": "markdown", + "id": "fae79440-b962-40fa-8274-ebffa48ccfb1", + "metadata": {}, + "source": [ + " In this case and since data has already been pre-processed, we will use the `FastQEK` kernel instead that speeds-up the computation and allows for computing matrix similarities." ] }, { "cell_type": "code", "execution_count": null, - "id": "55f264f6-18f5-4009-930a-12cce4a2cb87", + "id": "000780dc-cb6a-4d70-bfe4-c86bbf281278", "metadata": {}, "outputs": [], "source": [ @@ -629,7 +662,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.3" + "version": "3.12.7" } }, "nbformat": 4,