A practical guide

This post is part of the book: Hands-On Quantum Machine Learning With Python.

Bayesian networks are probabilistic models that model knowledge about an uncertain domain. Such as the survival of a passenger aboard the Titanic.

Bayesian networks build on the same intuitions as the Naïve Bayes classifier. But in contrast to Naïve Bayes, Bayesian networks are not restricted to represent solely independent features. They allow us to include as many interdependences that appear reasonable in the current setting.

A Bayesian network is represented as a directed acyclic graph with nodes and edges.

Image for post
Image for post
Image by author, Frank Zickert

The nodes represent random variables, such as the gender of a passenger or whether s/he was a child. …


What you see is not always what you get

This post is part of the book: Hands-On Quantum Machine Learning With Python.

The qubit state vector contains amplitudes rather than measurement probabilities.

The amplitudes belong to waves. Because in quantum mechanics, the behavior of quantum particles is described by wave functions.

Waves have three characteristics.

  • The wavelength is the distance over which the wave’s shape repeats.
  • The phase of a wave is the position on the waveform cycle at a certain point.
  • The amplitude of a wave is the distance between its center and its crest.

The following figure depicts these three characteristics.

Image for post
Image for post
Image by author, Frank Zickert

As we can see in the figure, amplitudes can be positive or negative. Whether the amplitude is positive or negative depends on the imaginary point x. If you chose a different point x∗, the same wave would have a negative amplitude. …


How to create a controlled-controlled-NOT-gate

This post is part of the book: Hands-On Quantum Machine Learning With Python.

Image for post
Image for post
Image by author, Frank Zickert

Quantum transformation gates allow us to work with qubits. The RY-gate allows us to specify the qubit state vector angle θ that controls the probability of measuring the qubit as either 0 or 1. We used it to let a qubit represent the marginal probability.


The trick no magician would reveal

This post is part of the book: Hands-On Quantum Machine Learning With Python.

When I first started learning quantum computing it took me quite a while to understand how it possibly could be faster than classical computing. Something mysterious must be going on.

Image for post
Image for post
Image by author, Frank Zickert

Of course, the quantum superposition a qubit can be in is astonishing. The qubit is not 0 or 1. It is in a relationship between states 0 and 1.

Notwithstanding, the ability to entangle two qubits is mind-blowing. You measure one qubit and another one instantly changes its state, no matter how far away it is. …


Calculating the posterior probability with a quantum circuit

This post is part of the book: Hands-On Quantum Machine Learning With Python.

Image for post
Image for post
Image by author, Frank Zickert

Most tutorials, posts, and books about quantum computing are loaded with math. Lots of math. Of course, math is an important aspect of the underlying concepts. But, I meant it when I said you don’t need to be a mathematician to master quantum computing.

Let’s look at quantum computing from the programmer’s perspective and work with qubits in a practical way.

If you know a little bit about probabilities, that’s enough. If not, here’s a brief recap.

There are different types of probabilities.

  • The Marginal Probability is the absolute probability of an…


Calculating the joint probability with Qiskit

This post is part of the book: Hands-On Quantum Machine Learning With Python.

Image for post
Image for post
Image by author, Frank Zickert

Most tutorials, posts, and books about quantum computing are loaded with math. Lots of math. Of course, math is an important aspect of the underlying concepts. But, I meant it when I said you don’t need to be a mathematician to master quantum computing.

In this post, we look at quantum computing from the programmer's perspective and work with qubits in a practical way. We leave aside all the theory and math. Ok, we still need a little math to calculate probabilities. But that’s it.

The only thing to understand is the different types of probabilities. …


This is what they mean with quantum computing can evaluate different states concurrently.

This post is part of the book: Hands-On Quantum Machine Learning With Python.

Image for post
Image for post
Image by author, Frank Zickert

Quantum computing comes with quite a few caveats.

  • When transforming qubits, you have to ensure reversibility.
  • You can’t copy a qubit in an arbitrary state.
  • And foremost, you can’t even measure a qubit without collapsing its state of superposition.

But a qubit can do things a classical bit can’t. A qubit is not restricted to 0 or 1. It can be a combination of both states. Further, you can entangle two qubits so that they share a state of superposition.

With these characteristics, qubits are a powerful tool. If used properly. Of course, you can treat qubits like normal bits and solve a problem the same way you solve other computational problems. But you would not benefit from the advantage a quantum computer promises. When solving a problem classically, you won’t see any quantum speedup. In fact, the algorithm will be much slower because a quantum computer is extremely slow (in terms of clock frequency) and extremely small (in terms of the number of qubits). …


The No-Cloning Theorem

This post is part of the book: Hands-On Quantum Machine Learning With Python.

Quantum computing is fundamentally different from classical computing. To master quantum computing you must unlearn what you have learned.

Image for post
Image for post
Image by Author, Frank Zickert

It starts with the quantum superposition. Unlike a classical bit, a quantum bit (qubit) is not 0 or 1. Unless you measure it, the qubit is in a complex linear combination of 0 and 1. But when you measure it, the quantum superposition collapses and the qubit is either 0 or 1, as a classical bit.

It continues with quantum entanglement. Two qubits can share a state of superposition. Once you measure one qubit, its entangled fellow instantly jumps to a different state of superposition. Even if it is light-years away. It seems to know a measurement has taken place and it takes on a state that acknowledges the measured value. …


Setup your quantum computing working environment on Windows

This post is part of the book: Hands-On Quantum Machine Learning With Python.

Image for post
Image for post
Image by author, Frank Zickert

If you’re a Python developer, there’s no way around a Unix-based operating system. Python is a language to write software that’s usually supposed to run at a server. And most servers run some kind of Linux.

Consequently, the default configuration in Python caters to the specificities of a Unix-based system. While Python works on Windows, too, it requires a lot more attention to get all the configuration details right. Starting from the path separator that is not a slash but a backslash (\) to the different charset (windows-1252), to different commands (e.g.


Hands-On Introduction To Quantum Entanglement

This post is part of the book: Hands-On Quantum Machine Learning With Python.

You may wonder what is the big deal with quantum computing. Why does everyone seem to be freaking out about this?

Einstein rejected the idea of quantum entanglement as spooky action at a distance that cannot be possible.

Image for post
Image for post
Image by author, Frank Zickert

Before we look at entanglement, usually, the first thing that comes to mind is quantum superposition. Some emphasize the notion of the quantum bit (qubit) being in the two states concurrently. And that’s so different from anything we know. …

About

Frank Zickert

I have been working as an IT professional for 17 years. I studied Information Systems Development and earned my PhD in 2012 at Goethe University of Frankfurt.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store