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

Kirk: *“Mr. Spock, have you accounted for the variable mass of whales and water in your time re-entry program?”*

Spock: *“Mr. Scott cannot give me exact figures, Admiral, so… I will make a guess.”*

Kirk: *“A guess? You, Spock? That’s extraordinary.”*

Spock: to McCoy *“I don’t think he understands.”*

McCoy: *“No, Spock. He means that he feels safer about your guesses than most other people’s facts.”*

Spock: *“Then you’re saying… it is a compliment?”*

McCoy: *“It is.”*

Spock: *“Ah. Then I will try to make the best guess I can.”* …

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.

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

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.

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. …

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

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.

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.

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. …

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

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
is the absolute probability of an…*Marginal Probability*

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

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 post is part of the book: **Hands-On Quantum Machine Learning With Python****.**

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). …

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.

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. …

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

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. `…`

About