#### Note

The results of using Monte Carlo estimation with\n :func:`~strawberryfields.apps.similarity.feature_vector_orbits` and\n :func:`~strawberryfields.apps.similarity.feature_vector_events` are probabilistic and may\n vary between runs. Increasing the ``samples`` parameter will increase the precision but\n slow down the calculation.

\n\nMachine learning with GBS graph kernels\n---------------------------------------\n\nThe power of feature vectors that embed graphs in a vector space of real numbers is that we can\nnow measure similarities between graphs. This is very useful in machine learning, where similar\nlabels are assigned to graphs that are close to each other. GBS feature vectors therefore give\nrise to a similarity measure between graphs!\n\nLet's build this up a bit more. The MUTAG dataset we are considering contains not only graphs\ncorresponding to the structure of chemical compounds, but also a *label* of each\ncompound based upon its mutagenic effect. The four graphs we consider here have labels:\n\n- MUTAG0: Class 1\n- MUTAG1: Class 0\n- MUTAG2: Class 0\n- MUTAG3: Class 1\n\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"classes = [1, 0, 0, 1]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We can use GBS feature vectors in a `support vector machine\n