Quantum Bayesian Networks

February 26, 2016

Quantum Fog gets Prefab Nodes (prefab but of high quality, I assure you)

Filed under: Uncategorized — rrtucci @ 7:02 am

Prefabricated or modular homes have a long history in the US and Europe. In the case of Quantum Fog, prefabricated Nodes also have a history. They were available in the Legacy QFog, and now, through the miracle of hard work, are available in the Pythonic QFog as well. I rewrote/translated the old C++ code responsible for the prefab nodes into Python.

So if you look at https://github.com/artiste-qb-net/quantum-fog, you will find a recently added folder entitled “prefabicated_nodes”. Inside that folder, you will find 7 new files, each containing a single class. The files are

  1. BeamSplitter.py
  2. CNot.py
  3. Marginalizer.py
  4. PhaseShifter.py
  5. PolarizationRot.py
  6. Polarizer.py
  7. QubitRot.py

Each of the above files has a long docstring describing its class. In my usual fashion, I also provided a “main” method at the end of the class with examples of how to use the methods of the class.

The motivation behind prefab nodes is simple to explain. A Bayesian Network, whether classical or quantum, assigns a transition matrix to each node. You can enter the components of that transition matrix by hand, but that gets tedious very quickly. In many cases, the matrix is a function of certain parameter and one wants to be able to enter those parameters and have the matrix generated automatically. For instance, for a qubit rotation, the matrix is a 2 by 2 unitary matrix determined by 4 real angles. One wants to be able to enter those 4 angles and have the matrix generated automatically. Similarly, for a CNot, the matrix is a 4 by 4 matrix with 4 entries equal to 1 and all others equal to 0. One wants to be able to enter the value of 2 boolean parameters and have the matrix generated automatically.

I think Donald Trump is a punishment meted out to us by God for the sins of Academics and other greedy, dishonest people. I’m mulling over this theory and may write a novel about it, or at least a comic book. That is, if we are all still alive a year from now.

Advertisements

February 17, 2016

Our baby (Quantum Fog) can now read, write and draw

Filed under: Uncategorized — rrtucci @ 12:06 am

In a special Feb. 2 , 2016, ground hog day blog post, I announced the first large release by our company, artiste-logoartiste-qb.net, of Pythonic open-source Quantum Fog. As you may or may not know, Quantum Fog was originally (almost 20 years ago) a Mac-only application written in C++. The GitHub page for Quantum Fog contains the legacy C++ code of yee ole Quantum Fog, plus the shining new Python code which will attempt to reproduce all the functionality of the old application plus much more. So are we there yet, you ask. Not quite, but making steady progress.

These are some of the things the new QFog can do so far:

  • It can do inference with evidence using 3 methods: Join Tree, MCMC (Monte Carlo) and brute force (enumeration of all Feynman paths).
  • It can do inference by those 3 methods for BOTH, quantum Bayesian networks (QBnets) and classical Bayesian networks (CBnets).
  • It can read and write CBnets and QBnets in two formats .dot and .bif (bif stands for Bayesian Interchange Format).
  • It can draw the CBnet and QBnet graphs using only matplotlib and networkx, included in the usual Python installation. This is fine for most purposes, but if you want a super high quality plot of your graph, you should use the .dot file that Quantum Fog generates and fine-tune that with GraphViz.

QFog integrates CBnets and QBnets seamlessly. You can use all subroutines for either classical or quantum analysis simply by changing a Boolean input parameter called is_quantum

Footnotes

  • .dot and .bif files are both just .txt files. The .dot format is used by a really wonderful, free software called GraphViz. There are several very helpful Bayesian network repositories that store Bnets in the .bif format. The .dot and .bif formats are complementary. The .dot format is good for storing visual layout info, not good for storing the numerical tables associated with each node. The .bif format is good in the opposite way.

  • The “join tree” (or junction tree, or clique tree or belief) propagation method is an exact method (Other methods, like MCMC, are approximate). The Join Tree method caused a mini revolution in the Bayesian networks field starting from 1990 or so. Before then, people had been discouraged by a proof that calculating probabilities from a Bnet by brute force is NP hard. But the Join Tree method takes advantage of the graph structure. If I understand it correctly, its complexity is exp(k) whereas brute force is exp(n), where n is the total number of nodes and k is the number of nodes in the fattest clique (k is called the width of the join tree). The Join Tree algorithm still has exponential complexity, but is much better than the brute force algo. The join tree algo used by the new Qfog is the one described in the following very detailed and clear, cookbook paper:

    Inference in Belief Networks, A Procedural Guide, by C. Huang and A. Darwiche (1996)

I end by waxing poetic in a nerdy way. Here are 3 things that remind me of quantum fog:


fog-machine
Fog Machines, very cool. An essential prop in the shooting of moody films, in rock concerts, in serious Halloween home decorations and in nerd experiments. They work by either (1) pushing a mixture of water and (glycol or glycerin or mineral oil) over a heated surface, or (2) dropping dry ice, i.e., solid CO2, into water heated near boiling point. Some use solid N2 or O2 instead to get a different kind of fog.


Aerogel.
Aerogels, very cool too.

They are very good thermal insulators. You can put your hand on one side and a Bunsen Burner flame on the other side of a ½ inch thick layer of aerogel and not feel the heat.

The ones that are almost transparent and ethereal looking are the silica aerogels. They are kind of expensive though, like $50 for a 1 x 1 x 0.5 in. specimen.

Wikipedia quotes:
“Aerogel was first created by Samuel Stephens Kistler in 1931, as a result of a bet with Charles Learned over who could replace the liquid in “jellies” with gas without causing shrinkage.”

“The first aerogels were produced from silica gels. Kistler’s later work involved aerogels based on alumina, chromia and tin dioxide. Carbon aerogels were first developed in the late 1980s.”


GoldenGateFog
And of course, the Golden Gate Bridge shrouded in fog.

February 6, 2016

Quantum Open Source 2016

Filed under: Uncategorized — rrtucci @ 7:31 am

big-bro-anim

Big Brother is saying: Microsoft’s “Liqui|> is closed source for your own good. Quantum open source is EVIL. Using it will harm you!”


Quantum Carly Fiorina

Quantum Carly Fiorina

Big Brother is saying: Vote for Quantum Carly Fiorina, my handpicked leader

Big Brother is saying: Vote for Quantum Carly Fiorina, my handpicked leader


apple1984-anim


quantum-open-source

On 2016, the quantum open source community will finally prevail, and you will see why future quantum computer software won’t be like “1984”

February 2, 2016

First Major Commit to Quantum Fog in Python

Filed under: Uncategorized — rrtucci @ 4:56 pm

Today is Groundhog day, Feb. 2, 2016. This holiday holds special significance in Quantum Computing History. Indeed, on another Groundhog day in the distant past, in the year 2015, a watershed historic quantum event occurred, namely Jimmy the Groundhog bit Seth Lloyd’s ear.

Other quantum watershed events have occurred since them, like, for example, Caltech held its “One Entangled Evening” and Alex Winter screened his NSF funded 10 minute mini-movie “Anyone can Quantum”. But those events are California/Hollywood glitzy, whereas groundhog day is a more folksy affair (old white men with funny top hats bugging a chubby rodent who just wants to go back to sleep).

artiste-logo Since we here at artiste-qb.net are more folksy than glitzy, we decided to celebrate this holiday by releasing today our first version of Quantum Fog in Python (QFog is open sourced under the BSD license, and it is available at GitHub)

Basically, what I did was to refurbish an old open-source program called PBNT by Elliot Cohen. PBNT does classical Bayesian Networks using 3 inference algorithms: Enumeration (brute force), MCMC and Join Tree (aka Junction Tree).

The join tree algo used by PBMT and QFog is the one described in the following very detailed and clear, cookbook paper: _Inference in Belief Networks, A Procedural Guide_, by C Huang and A. Darwiche (1996)
http://www.ar-tiste.com/Huang-Darwiche1996.pdf

Our new QFog release does BOTH, classical and quantum Bnets using the same 3 algos. One of our eventual goals is to write a quantum computer programming language based on quantum Bnets.

Blog at WordPress.com.

%d bloggers like this: