Quantum Bayesian Networks

December 16, 2017

In Love With Jupyter Widgets

Filed under: Uncategorized — rrtucci @ 11:56 pm

Many old fashioned computer programs that allow a lot of pointing and clicking, what I like to call “GUI-rich” software (GUI=Graphical User Interface), provide you with only a limited “scripting and documenting” ability, i.e., ability to save and restore your work history (including the buttons you clicked and in what order, the plots you generated, your comments, etc.). Before the advent of Jupyter widgets, Jupyter notebooks got an A++ grade in scripting ability, but an F in GUI. Old fashioned, GUI-rich software got the opposite grades. So it might have been hard back then to decide which of these two paths, GUI-rich or Jupyter, to choose. But this is no longer a hard choice. With Jupyter widgets, Jupyter notebooks get an A++ in both categories.

In my opinion, scripting ability is very desirable when doing work related to statistics, Bayesian networks, Big Data, AI, numerical research, etc. A GUI is desirable too, especially if you want normal people, i.e. non-geeks, ever to use your software! So I am glad to announce that Quantum Fog now has some Jupyter notebooks with widgets.

In the following folder, you will find notebooks for doing inference with the (classical, not quantum) WetGrass and Asia networks. This is a link to GitHub, so of course the GUI is displayed but doesn’t work properly there. It only works properly if you are running the notebook in a Python environment.


August 15, 2017

Resistance is Futile: Jupyter Borg Threatens to Assimilate Quantum Computing Universe

Filed under: Uncategorized — rrtucci @ 5:00 pm

A week ago, IBM announced at its Quantum Experience usegroup that it had uploaded to github a large collection of jupyter notebooks exhibiting the use of their gate model quantum computer (previously 5 qubits, currently 16 qubits). I consider this an excellent addition to the quantum open source and free jupyter notebook universe and ecosystem. I’ve advocated for quantum open source and jupyter notebooks many times before in this blog, so it’s a pleasure for me to echo their announcement.

Pow! Right in the kisser of Microsoft’s Liqui|> software. Liqui|> is closed source software.

Google has announced that it will deliver by year’s end a 49 qubit gate model qc with accompanying open source software and cloud service. The jupyter ball is now in your court, Google.

Artiste-qb.net, the company that I work for, already provides a large and ever growing library of jupyter notebooks for both of its quantum open source offerings, Qubiter and Quantum Fog.

Rigetti’s PyQuil and ProjectQ are two other gate model qc simulators analogous to IBM quantum experience. So far these two have very few jupyter notebooks. Wimps! Laggards! Let them eat cake!


Borg Cake


Jupyter Cake

September 20, 2016

In Love With Jupyter Notebooks, Post-Processing Your Lab Notebook

Filed under: Uncategorized — rrtucci @ 6:16 pm

I am pleased to announce on behalf of http://www.artiste-qb.net artiste-logothat our open source BSD licensed programs Qubiter and Quantum Fog now have some Jupyter Notebooks (JN’s), the first of hopefully many JN’s to come in the future. So far, Qubiter has 2 notebooks explaining Teleportation and the IBM Quantum Experience, whereas Quantum Fog has a notebook testing some ideas on how best to plot a quantum density matrix.

The way I see it, JN’s represent a method of using software that seems better suited for scientific investigations than the older method of “GUI (graphical user interface) rich” software.

Typically, GUI rich programs allow you to save some files with the fruits of your labor, but there are often several of those files, perhaps written in different formats, some human readable text formats and some propietary non-human readable ones. A JN, on the other hand, merges all those files into a single one that is stored in an open, very common, multimedia, browser readable format called JSON. The JN also records the commands that led to each of the files that are being merged plus it allows you to insert rich text comments between those files. All this makes JN’s, in my opinion, a much more unified, clear and complete way of documenting your thought process, both for yourself, and for others who might be interested in following your work.

Consider the lab or work notebooks of famous scientists (DaVinci, Darwin, Newton, Feynman, …). I for one find those brain storming and data recording documents endlessly fascinating and hope they continue to be written on paper and by hand till the end of humanity, but even those historic documents would have benefitted from some post-processing using the full panoply of modern computer tools now available to us. Imagine a Leonardo or a Darwin or a Feynman notebook with simulations and some plots and statistical analysis. Raw data can be post-processed using statistical packages. Thorny equations can be post-processed too, with symbolic manipulation programs, numeric algorithms programs and plotting programs. Such post-processing is what JN’s allow us to do.

The idea of writing software for creating such notebooks is not new. Although probably not the first software to use them, Wolfram’s Mathematica did much to popularize them. Even if you have never heard of JN’s, you probably have encountered Mathematica notebooks by now, wonderful multimedia files that can contain and execute Mathematica code, plots, animations, text with Latex equations embedded in it, etc. JN apps do all of that too, but they are open source under BSD license. They are much more adaptable to other platforms. They also rely more on browser and internet software resources (HTML, JavaScript, MathJax for LaTeX rendering, JSON format…) so they are ideally suited for an application running on the cloud, although they can also be run autonomously on a single PC.

JN’s were originally built as an app that ran on top of IPython, a command shell for Python, but the app has been carefully written so that it can be easily assimilated by other computer languages. 30 to 40 computer languages already have JN’s, including many languages that are not interpreted languages. Interpreted languages are languages like Python and Mathematica that are designed to run one line at a time.

Home of project Jupyter:

The original programmer of IPython and JN is Fernando Perez. Here is blog post by him describing JN history.

May 24, 2018

Quantum Computing and a new book, “The Book of Why”, by Judea Pearl and Dana Mackenzie

Filed under: Uncategorized — rrtucci @ 5:23 am

“Leaping the Chasm” (1886) by Ashley Bennett, son of photographer Henry Hamilton Bennett, jumping to “Stand Rock”. See http://www.wisconsinhistory.org

Judea Pearl, UCLA professor, winner of the Turing Prize in Computer Science, is a hero to all Bayesian Network fans like me. Pearl has several books on B nets, as you can see at his Amazon page.. This blog post is to alert my readers to his most recent book, written in collaboration with Dana Mackenzie, released about a week ago, mid May 2018, entitled “The Book of Why: The New Science of Cause and Effect”.

To commemorate the release of the new book, I also wrote, besides this blog post, a small comment about the new book at the Edward Forum, and Dustin Tran, main author of Edward, responded with a comment that cites a very nice paper, less than 6 months old, by Dustin and Prof. Blei, Dustin’s thesis advisor at Columbia Univ, about the use of Judea Pearl’s causality ‘do-calculus’ within Edward.

I’ve been interested in the do-calculus for a long time, and have written two arxiv papers on the subject:

  1. Introduction to Judea Pearl’s Do-Calculus, by Robert R. Tucci (Submitted on 26 Apr 2013)
  2. An Information Theoretic Measure of Judea Pearl’s Identifiability and Causal Influence, by Robert R. Tucci (Submitted on 21 Jul 2013)
    This paper is for classical Bayesian Networks, but it can easily be generalized to quantum Bayesian Networks, by replacing probability distributions by density matrices in the information measure proposed there.

There exist more than a dozen packages written in R that implement at least partially the do-calculus. They are available at CRAN (the main R repository, named after cranberries).
This 2017 paper
contains a nice table of various R packages dealing with do-calculus.

It’s also interesting to note that BayesiaLab, a commercial software package that I love and recommend, already implements some of Pearl’s do-calculus. (full disclosure: the B net company that I work at, artiste-qb.net, has no business connections with BayesiaLab.)

By the way, artiste-qb.net provides a nice cloud service that allows you to run all these open-source do-calculus R packages on your browser, without any installation hassles. How? you ask, and if not, I’m going to tell you anyway.

***Beep, Beep, Commercial Alert***

artiste-qb.net is a multilingual (R, Python, Java, C++, English, German, Spanish, Chinese, Italian, French, you name it, we speak it) quantum open source software company.

We offer an image on AWS (the Amazon cloud service) called BayesForge.com.

BayesForge.com comes fully loaded with the Python distribution Anaconda, all of R, etc.

Bayesforge comes with most major Artificial Intelligence/Bayesian Networks, open-source packages installed, both classical ones (eg. TensorFlow, Edward, PyMC, bnlearn, etc) and quantum ones (eg., IBM Qiskit, DWave stuff, Rigetti and Google stuff, our own Quantum Fog, Quantum Edward, Qubiter, etc).

BayesForge allows you to run jupyter notebooks in Python, R, Octave (an open source matlab clone) and Bash. You can also combine Python and R within one notebook using Rmagic.

We have succeeded in dockerzing the BayesForge image and will be offering it very soon on other cloud services besides AWS, including a non-AWS cloud service in China, where AWS is so slow it is non-usable. One of our co-founders, Dr. Tao Yin, lives in ShenZhen, China, and is in charge of our China branch.

April 6, 2018

PyMC and Edward/TensorFlow Merging?

Filed under: Uncategorized — rrtucci @ 9:09 pm

News bulletin: Edward is now officially a part of TensorFlow and PyMC is probably going to merge with Edward.

The python software library Edward enhances TensorFlow so that it can harness both Artificial Neural Nets and Bayesian Networks. The main architect of Edward, Dustin Tran, wrote its initial versions as part of his PhD Thesis at Columbia Univ. (Columbia is the home of the illustrious Andrew Gelman, one of the fathers of hierarchical models, which are a special case of Bayesian networks). Dustin now works at Google as part of a team merging Edward with TensorFlow.

One of the near term goals of artiste-qb.net is to produce a quantum generalization of Edward. This would not run on a quantum computer but would simulate on a distributed classical computer possible experiments that could in the future be conducted on a qc.

I highly recommend the following two Discourses for Edward and PyMC:

It looks like the python software libs PyMC3 and Edward may soon merge:


This is very good news, in my opinion, because I am in love with both programs. It’s interesting to note that the current Numpy is also the result of the fortuitous marriage of two separate complementary software libs.

One can now call PyMC3 and Edward from Quantum Fog, although not very smoothly yet. See here.

February 9, 2018

Today Enrolled our Baby (Quantum Fog) in gambling school taught by famous Monte Carlo gamblers (PyMC3, Edward, Zhusuan)

Filed under: Uncategorized — rrtucci @ 4:57 am

In the beginning, there was Matlab, which grew out of the Fortran lib Lapack (Linear Algebra Package, still one of the main software libs used to benchmark supercomputers). Matlab’s tensor stuff was copied and improved by the Python borgs to produce numpy, which handles tensors really nicely but doesn’t do it in a distributed “parallel” fashion. Then, starting about 10 years ago, some guys from the University of Montréal had the brilliant idea of writing the Theano Python Library (Theano was a Greek mathematician thought to have been the wife of Pythagoras). Theano replaces most numpy functions with Theano functions that are namesakes of the numpy ones and do the same thing in a distributed fashion. Then Google came out with the TensorFlow Python Lib, which copied Theano and improved on it. TensorFlow can do most numpy operations using multiple CPUs, GPUs and TPUs. But TensorFlow and Theano are much more than tools for doing tensor operations in a distributed fashion. They also do differentiation in a distributed fashion (such differentiation is often used to train neural nets). They are also designed to help you do fast prototyping and distributed running of artificial neural nets. In the last year, some new Python libraries built on top of TensorFlow and Theano have appeared that allow you to do fast prototyping and distributed running of Bayesian networks. B nets are dear and near to my heart and I consider them even more powerful than artificial neural networks. And I’m far from being alone in my love of b nets. Judea Pearl won the prestigious Turing prize for his pioneering work on them. Those new Python libs that I alluded to are PyMC3 (built on top of Theano), Edward (on top of TensorFlow) and Zhusuan (on top of TensorFlow). Added later: Forgot to mention that Facebook & Uber have their own Theano equivalent called PyTorch and also an Edward equivalent called Pyro. But I haven’t used them yet.

The main architect of Edward is Dustin Tran, who wrote Edward as part of his PhD thesis at Columbia Univ. Dustin now works at Google, and the TensorFlow team is working with Dustin to integrate Edward with TensorFlow.

Zhusuan is the art of using an abacus. The word means literally “bead counting” in Chinese. The Zhusuan lib is a fine open-source (under MIT license) product of the Tsinghua University in Beijing, China. It demonstrates that China is already very advanced in AI.

According to Google Trends, “TensorFlow” is at least 10 times more popular than “quantum computing” as a search term, even though TensorFlow has many competitors that started before it did and it was open sourced for the first time only 2 years ago.



One of the aims of artiste-qb.net is to participate in the revolution of extending Edward & Tensorflow so that it can do both classical and quantum Bayesian Networks. Today we took a small, initial step in that direction. We added a folder


which contains a file called ModelMaker.py and two jupyter notebooks. Both notebooks do MCMC for the classical Bayesian network WetGrass. One notebook does this by invoking the external software PyMC (a.k.a. PyMC2, the precursor of PyMC3), whereas the other does it via PyMC3. Both notebooks start by loading a .bif file for the WetGrass bnet. From that alone, they construct an X native model and analyze that model using X, where X = PyMC2, PyMC3. In the near future, we will also add a notebook that does the same thing for X=Edward, Zhusuan.
Addendum(Feb.16, 2018): Added support for Edward

climbing-mt-qc(Image by Henning Dekant)

January 1, 2018

New tools for dealing with limited couplings of a quantum computer chip

Filed under: Uncategorized — rrtucci @ 11:37 pm

The main purpose of this blog post is to announce that Qubiter now has two simple, but hopefully useful, new classes that facilitate writing qc programs for the new crop of qc’s with 20-50 qubits but such that those qubits are not fully connected (coupled):

  1. Class ForbiddenCNotExpander reads an English file and writes a new English file. Any CNot in the old file that is not physically allowed by a pre-specified qc chip is replaced in the new file by an expansion (sequence) of allowed CNots.

  2. Class ChipCouplingsFitter reads an English file and writes a new English file. The new file permutes the qubits of the old file so that the old CNots are mapped into new ones that are allowed for a pre-specified qc chip. Of course, this is not always possible, so the class only promises to find such a mapping and to tell you what it is if it finds one.

I hope these 2 new classes will make it easier for Qubiter users to interact with real qc hardware of any brand.

We are striving to make Qubiter interact with as many qc hardware brands as possible. So far, we have targeted the IBM chips with a class called Qubiter_to_IBMqasm2 that translates a Qubiter English file (i.e., Qubiter’s version of qasm) to IBM qasm2. As soon as Google comes out with its 49 qubit qc and accompanying cloud service, which Martinis has promised for Jan 2018, we will target Google devices too, by writing a translator from Qubiter English files to Google’s version of qasm. This IBM or Google qasm can be sent by a Jupyter notebook via the internet to the IBM or Google quantum computers sitting in the cloud, which will then run the program and send back the results to the original Jupyter notebook.

We are trying to design Qubiter so that it facilitates communication not only between a user and multiple hardware devices, but also among multiple users. Indeed, Qubiter already makes it easy for users of different qc devices, for example Alice who uses an IBM chip and Bob who uses a Google chip, to be on friendly terms with each other, maybe even go out on a date. Qubiter facilitates such dalliances because it saves quantum circuits as simple yet clear text files. This makes it as easy as pie to modify those text files, save them to improve them at a later date, and share them with other qc engineers. I you want to collect quantum circuits like you would collect baseball cards, comic books, stamps, butterflies or whatever, Qubiter’s English and Picture files found in Qubiter’s io_folder are a great way of doing it.

October 18, 2017

One small step for Qubiter, one giant step for Alibaba

Filed under: Uncategorized — rrtucci @ 10:06 pm

In a previous blog post, I used the example of teleportation of a 1 qubit state to compare 3 popular quantum computer simulators: (1) artiste-qb.net’s Qubiter (of which I am the main author), (2) IBM’s Quantum Experience and (3) Microsoft’s Liqui|> sequel. I gave many reasons why I think Qubiter is much better than the other 2 (clearer, simpler, more logical design, more commands, open source under BSD license, Python, many Jupyter notebooks, includes translators from Qubiter’s qasm to IBM’s qasm and soon to Google’s qasm, …)

Today, I am proud to announce that Qubiter now has 2 of its Jupyter notebooks in both English and Chinese (translator: Dr. Tao Yin, CTO of artiste-qb.net, living in Shenzhen, China)

Alibaba must have heard about our Chinese notebooks and decided to match our move and better it by a smidgen. On Oct 10, 2017, they announced to the press that they are planning to spend $15B over the next 3 years on moonshot projects like AI and quantum computing. At the same time, they unveiled at a conference a quantum computing cloud service.

October 3, 2017

A Microsoft Quantum Computing language by any other name would smell as badly

Filed under: Uncategorized — rrtucci @ 3:31 am

On September 25-29, 2017, Microsoft held its IGNITE conference at Orlando, FL. Arstechnica reported about IGNITE here. They usually publish quantum computing articles that are more balanced and well informed than the average sci-tech popular journal. This time though, I think Arstechnica dropped the ball badly. This article sounds to me like a glorified infomercial for MS. However, I did learn a few curious facts from it.

The article reports that MS intends to release by the end of this year a “quantum programming language—as yet unnamed” for programming quantum computers. The language will be distributed with Visual Studio and available on Azure, the MS cloud service. Let me henceforth call it language Q?#. The article gives the following snapshot of a quantum teleportation circuit written in this marvelous new language. A Rube Goldberg machine language if I ever saw one. Also, sounds like this ugly baby is going to be CLOSED SOURCE, just like LiquiD. (Click image to enlarge)

Mysteriously, no mention is made of Liqui|>, MS’s previous “quantum programming language”. Since Q?# comes a short time after Liqui|> and Dave Wecker is the main author of both, it is safe to assume that Q?# is just a new wrapper with Liqui|> under the hood. (Some have gone so far as to suggest that the new language should be called LiquidShit#).

But friends, Romans, countrymen, lend me your ears. I have come here to bury Q?#, not to praise it. Next, I will show the code for the same quantum Teleportation 3 qubit circuit, but written instead in IBM’s qasm language and in Qubiter’s language.

IBM’s github repository called qiskit-tutorial has a Jupyter notebook for this same teleportation circuit. Here is a snapshot taken from the notebook showing IBM qasm for the teleportation circuit.

The Qubiter repo at github also has a Jupyter notebook for the same teleportation circuit. Here is a snapshot taken from the notebook showing Qubiter’s English and Picture files for the teleportation circuit.

And now, let me indicate a few reasons why I think Qubiter (which I wrote) is nicer than the other two.

  • Qubiter allows one to write controlled gates with any number of controls, and the controls can be of two types T or F. (T controls are usually represented in latex pictures of quantum circuits by a solid dot, F controls by a hollow dot). Qubiter also has subroutines that allow one to expand each gate with multiple controls into a sequence of gates with only one or zero controls, because those simpler gates are the only type of gates that most hardware devices can perform physically. IBM’s qasm so far only allows one or two controls of type T only. They have CNOT and CCNOT and that’s it.
  • Qubiter automatically generates an ASCII picture of the circuit at the same time that it generates its English qasm-like file. IBM’s q-software and LiquiD do not write a picture of the circuit automatically. If they draw a circuit, it requires a separate run to generate it and the picture is in Latex. Also, their circuit pictures have time running from left to right instead of downwards. Qubiter’s English and Picture files, on the other hand, have the highly desirable properties–especially desirable for long circuits–that (1) time runs downward in both English and Picture files, and (2) line number n in the English file corresponds to line number n in the Picture file.
  • IBM qasm and LiquiD distinguish between quantum and classical registers. Qubiter only has quantum registers. Classical registers are an unnecessary, ugly complication because the information stored in them can be stored in the memory of your pc.

Two other languages, Rigetti’s PyQuil and ProjectQ, are similar to IBM qasm and suffer from some of the same architectural design flaws mentioned above.

UPDATE: Microsoft released their Rube Goldberg “quantum language” with much fanfare on Dec. 11, 2017. They called it, after so much suspense, simply Q#. MS is not known for their creativity in naming things.

April 29, 2017

Miss Quantum Computing, may I introduce to you Miss Bayesian Hierarchical Models and Miss MCMC?

Filed under: Uncategorized — rrtucci @ 5:49 pm

Warning: Intense talk about computer software ahead. If you are a theoretical computer scientist, you better stop reading this now. Your weak constitution probably can’t take it.

When you enter the nerd paradise and secret garden that is Bayesforge.com (a free service on the Amazon cloud), you will see one folder named “Classical” and another named “Quantum”. Here is a screenshot of this taken from Henning Dekant’s excellent post in Linkedin

The “Quantum” folder contains some major open source quantum computing programs: Quantum Fog, Qubiter, IBM-QisKit (aka kiss-kit), QuTip, DWave, ProjectQ, Rigetti

The “Classical” folder contains some major Bayesian analysis open source programs: Marco Scutari’s bnlearn (R), Kevin Murphy’s BNT (Octave/matlab), OpenPNL (C++/matlab), PyMC, PyStan.

The idea is to promote cross fertilization between “Quantum” and “Classical” Bayesian statisticians.

Today I want to talk mostly about PyMC and PyStan. PyMC and PyStan deal with “Hierarchical Models” (Hmods). The other programs in the “Classical” folder deal with “Bayesian Networks”(Bnets).

Bnets and Hmods are almost the same thing. The community of people working on Bnets has Judea Pearl as one of its distinguished leaders. The community of people working on Hmods has Andrew Gelman as one of its distinguished leaders. You might know Gelman (Prof. at Columbia U.) from his great blog “Statistical Modeling, Causal Inference, and Social Science” or from one of his many books

Both PyStan and PyMC do MCMC (Markov Chain Monte Carlo) for Hmods. They are sort of competitors but also complementary.

PyStan (its GitHub repo here) is a Python wrapper of a computer program written in C++ called Stan. According to Wikipedia, “Stan is named in honour of Stanislaw Ulam, pioneer of the Monte Carlo method.” Prof. Gelman is one of the fathers of Stan (I mean the program, of course).

PyMC comes in 2 incompatible versions: 2.X and 3.X. Version 3 is more advanced and intends to replace Ver 2. PyMC2’s best sampler is a Metropolis-Hastings (MH) sampler. PyMC3 contains an MH sampler, but it also contains the “No U turns” or “NUTS” sampler that is supposed to be much faster than MH for large networks. Currently, Bayesforge contains only PyMC2, but the next version will contain both PyMC2 and PyMC3. As an added bonus, PyMC3 comes with Theano, one of the leading deep neural networks frameworks.

Check out this really cool course:

Sta-663 “Statistical Programming” , available at GitHub, taught at Duke U. by Prof. Chi Wei Cliburn Chan.

This wonderful course has some nice jupyter notebooks illustrating the use of PyMC2, PyMC3 and PyStan. Plus it contains discussions of many other statistical programmimg topics. I love it. It has a similar philosophy to BayesForge, namely to do statistical programming with jupyter notebooks because they are great for communicating your ideas to others and allow you to combine seamlessly various languages like Python, R, Octave, etc

April 8, 2017

Welcome to BayesForge, a free service on the Amazon cloud

Filed under: Uncategorized — rrtucci @ 7:08 am

Our company artiste-qb.net is proud to announce BayesForge.com (BF), our new service on AWS (Amazon Web Services). BayesForge is not yet open for business but will open in a week or less. The purpose of this blog post is to give an overview and teaser of what is coming.

Henning Dekant will give a tour of BF to those who attend the meeting on April 21 of the Toronto Quantum Computing Meetup.

Why AWS?

The Amazon cloud is one of the largest and Amazon offers an incredible deal to all its customers. Anybody with a credit card can get an AWS Free Tier account. An AWS Free Tier account gives you one full year of free cloud use (there are some upper bounds on usage but very generous ones). Furthermore, you can open a separate AWS Free Tier account in the name of your spouse and each of your children. Amazon doesn’t seem to care!! Only Jeff Bezos could be so crazy generous. Once you have an AWS Free Tier account, you can use it to play with BayesForge for a whole year, free of charge. You don’t have to be a student to do this.

What can you do with BayesForge?

BF allows you to write Jupyter notebooks on your web browser in a wide variety of languages and run/store those notebooks on the cloud. (Besides the web browser, no additional software needs to be installed on your computer). We have installed Jupyter kernels for Python-3, Python-2, R, Octave (clone of matlab) and bash. This means you can write/run a notebook in which you use one of those languages exclusively. We have also installed Rmagic and Octavemagic which allows you to write a notebook in Python but dip temporarily into R or Octave.

What software packages does BayesForge include?

BF comes with 2 folders called “Classical” and “Quantum”. The “Quantum” folder contains a large selection of open source quantum computing software, including our own Quantum Fog and Qubiter, and also open source qc software from DWave, IBM, Rigetti, etc. The “Classical” folder contains a large selection of open source software for doing classical bayesian statistical analysis.

This is the logo of BayesForge (graphics by our inhouse artiste and Gimp wizard, Henning Dekant. BayesForge name suggested by Gavin Dekant)

“True gold is not afraid of fire.”
(Chinese Proverb)

“Incus robust malleum non timet”
“A strong anvil need not fear the hammer.”
(Latin Proverb)

April 5, 2017

Tao Yin teleports (the old fashioned way) 2 entangled cats from Germany to China

Filed under: Uncategorized — rrtucci @ 5:11 pm

In this photo you can see Tao Yin at the Frankfurt airport, before boarding an airplane to China, transporting cat #1. Cat #2 was teleported by his wife on same flight. One small pet per passenger allowed. Cats 1 and 2 are friends that were entangled at a distance during the flight.

Dr. Tao Yin obtained a Ph.D. in Physics at the end of last year from
The Goethe University in Frankfurt. He started at artiste-qb.net as a long-distance intern last summer, but he is now CTO and part owner of artiste-qb.net . He has quickly become an important part of our company. He has just moved from Frankfurt-Germany to Shenzhen-China, where he will continue to represent us. Shenzhen, population ~ 11 million, is one of the 5 largest cities in China, a technology power house located immediately north of Hong Kong.

Tao brings to artiste-qb.net excellent computer skills and knowledge of physics. We are also relying on him to translate to Mandarin Chinese some of our software docs. For example, he translated the Jupyter notebooks quantum_compiler_intro.ipynb to quantum_compiler_intro_CN.ipynb. These jupyter notebooks explain how to use the quantum compiler in our open source software Qubiter. Qubiter has had a fully-functional quantum compiler since the first week of Jan of 2017. Currently, Qubiter is the only software to offer a quantum compiler of this kind.

March 20, 2017

BNT and PNL, two masterpieces of Bayesian Networks retro-art

Filed under: Uncategorized — rrtucci @ 8:58 pm

An update on the latest adventures of our company artiste-qb.net.

In previous blog posts, I waxed poetic about Marco Scutari’s open source software called bnlearn for learning the structure of bnets (Bayesian networks) from data. bnlearn is written in the language R whereas Quantum Fog is written in Python. But by using Jupyter notebooks with Rmagic installed, we have been able to write some notebooks running both QFog and bnlearn side by side in the same notebook for the same bnets, and to compare outputs of both programs. That is a good bench-marking exercise for the bnet learning side of QFog, but what about it’s bnet inference side?

Two open source programs that are very good at doing bnet inference (and many other things too) are BNT (Bayes Net Toolbox, by Kevin Murphy et al) and OpenPNL (PNL = Probabilistic Networks Library, written by Intel. I like to call it PaNeL to remember the letters quickly).

So our next adventure is to learn how to use BNT and PNL and to compare them to QFog.

BNT is written in Matlab. PNL is written in C++ but it includes Matlab wrappers for most of its functions. Both BNT and PNL are very mature and comprehensive programs. Since its core is written in C++ rather than Matlab, we expect PNL to be much faster than BNT for large networks.

As you already know if you’ve ever checked Matlab’s pricing, the software is very costly for everyone except students. However, this is one case when the open source gods have listened to our prayers. Octave is a free, open source program that can run 99% of a Matlab program and the few differences between Matlab and Octave (mostly in the plotting packages) are well documented. Furthermore, one can run Octave in a Jupyter notebook, either on an Octave kernel or on a Python kernel with octavemagic (oct2py) installed.

So in order to compare QFog to bnlearn, we’ve had to start using Jupyter notebooks on R kernel  or on Python kernel with Rmagic. And in order to compare QFog with BNT&PNL, we’ve had to start using Jupyter notebooks on Octave kernel or on Python kernel with octavemagic. We have seen the light and we are now believers in a holy trinity of computer languages (diversity and open source is our strength, Mr Trump):

Python, R, Octave
(our polyglot notebooks)

Curiously, Duke Univ. offers a course called “Computational Statistics in Python” that also advocates the use of Jupyter notebooks, and the languages Python, R and Matlab intermixed to do statistics. So when two cultures independently come up with the same idea, it’s probably a good one, don’t you think?

Since BNT is written in Matlab, running it does not require any compilation. PNL, on the other hand, is written in C++, so it does. Compiling PNL has proven a difficult task because the software is ten years old, but, after a lot of sweat and tears, our wiz Henning Dekant has managed to compile it (a few issues remain).

BNT was last changed in a bigly way circa 2007 (or even earlier) and PBL on 2006. (bnlearn, by comparison, is still very active). BNT and PNL belong to what I like to call the first bnet revolution (inference by junction tree) whereas bnlearn belongs to the second revolution (structure learning from Markov blankets). Even though PNL belongs to the first, not second, revolution, it is a major mystery to me why Intel abandoned it. PNL is a very impressive, large and mature piece of software. A lot of work, love and passion seems to have gone into it. Then sometime in mid 2006, it seems to have been abandoned in a hurry, and now it looks like a ghost town, or the deserted island in the video game Myst. I already know how the game Myst ends. If anyone knows why Intel stopped PNL development circa 2006, I would appreciate it if you would tell me, either in public in this blog or in private by email. Luckily, Intel had the wisdom to make PNL open source. PNL will go on, because 💍OPEN SOURCE IS FOREVER💍.

Sorry for the length of this blog post (almost as long as a Scott Aaronson blog post or a never ending New Yorker article).


February 22, 2017

Quantum Fog’s weight in bnlearn units

Filed under: Uncategorized — rrtucci @ 2:42 am

In a recent blog post entitled “R are Us. We are all R now”, I expressed my great admiration for the R statistical computer language, and I announced the addition to the Quantum Fog (QFog) GitHub repository of a Jupyter notebook called “Rmagic for dummies” which explains how something called Rmagic allows one to run both Python and R in the same Jupyter notebook.

In 2 other earlier blog posts, I also expressed great admiration for something else, bnlearn, an open source computer program written in R by Marco Scutari for learning classical Bayesian networks (cbnets) from data. I consider bnlearn the gold standard of bnet learning software.

The main purpose of this blog post is to announce that the QFog GitHub repo now has a folder of Jupyter notebooks comparing QFog to bnlearn. This is a perfect application of Rmagic to comparing two applications that can do some of the same things but one app is written in R while the other is written in Python. Pitting QFog against bnlearn is highly beneficial to us developers of QFog because it shows us what needs to be improved and suggests new features that would be worthwhile to add.

QFog can do certain things that bnlearn can’t (most notably, QFog can do both classical and quantum bnets, whereas bnlearn can only do classical bnets), and vice versa (for instance, bnlearn can do bnets with continuous (Gaussian) node probability distributions, whereas QFog can only handle discrete PDs), but there is much overlap between the 2 software packages in the area of structure and parameter learning of classical bnets from data.

A cool feature of the folder of Jupyter notebooks comparing bnlearn and QFog is that most notebooks in that folder can be spawned and run from a single “master” notebook. This amazing ability of the “master” notebook to create and direct a zombie horde of other notebooks is achieved thanks to an open source Python module called “nbrun” (notebook run).


February 11, 2017

R are us. We are all R now.

Filed under: Uncategorized — rrtucci @ 5:08 pm

I have long been an enthusiastic proponent of R, a computer language designed for doing statistical analysis. In fact, 7 years ago I wrote a post in this blog entitled “Addicted to R”.

Our company (artiste-qb.net) has been publishing software written mostly in Python. The Python ecosystem includes a very nice statistical package called Pandas, whose authors profess much love for R and unabashedly admit that they were trying to copy the best of R’s statistical functionality and bring it to Python users. This is fine and good, but is not enough, is it?

R has been around for a long time (since 1993 according to Wikipedia), and during that time it has managed to accumulate a formidable number of highly useful extension packages and a very large and passionately committed community of fans. As good as Pandas is, it would be a pity and outright foolish if our company and others in the same boat ignored R’s rich libraries and numerous users.

So I was elated when Tao Yin, a member of our company, introduced our company members to rpy2 and its extension Rmagic. Rmagic allows one to invoke R functions inside a Jupyter notebook running with a Python kernel. So in a single Jupyter notebook, you can call both Python functions and R functions in the same cell, or have some cells running just R and others running just Python. And of course, variables can be exchanged easily between R and Python within that notebook. So we are all R now. And Python too.

I’ve only known about Rmagic for about a week so I’m a newbie at it. Fortunately, even though rpy2/Rmagic is very sophisticated software under the hood, it’s API (Application Programming Interface) is quite simple and intuitive. I wrote a Jupyter notebook called “Rmagic for dummies” that I hope will convince you that Rmagic is very powerful yet easy to use.

Next Page »

Create a free website or blog at WordPress.com.

%d bloggers like this: