QxBranch’s Quantum Feature Detector library (QxQFD) provides a class of quantum machine learning functions. It is a
simple interface for using quantum transformations to detect features in data as part of a machine learning application
stack using Rigetti’s Forest back-end.

Quantum feature detectors (QFDs) apply quantum circuits to transform data and identify complex, nonlinear features to
improve the accuracy of machine learning models. QxQFD is provided as a software framework to support experimentation
with QFDs, and we encourage users to try out QxQFD on their own problems. QFD performance versus classical methods of
nonlinear feature detection is an open research question, and one of great interest as the fields of quantum computing
and machine learning both develop rapidly.

In supervised machine learning, the challenge is to take a set of labeled data and extract features that identify the
labels, ie. work out what makes an image more likely to be a cat than a car. Then, given previously unseen data, label
that data based on the model built from the features.

The features used to train the model can be any number of things - in our cat vs. car image classification example, we
could use the individual pixels of the image to inform our features. This could quickly run into problems though; if
pixel 12 is black, are we more likely to have a cat or a car? In our training data, there might be many examples of
black cats and black cars, not to mention black-colored surroundings in the images. The color of pixel 12 is not
actually a useful feature. To get useful features, these basic features can be combined to create so called
“higher-level” features; for example, looking at a subset of pixels to identify curves or edges in an image - the curve
is the higher-level feature.

Commonly, transformations are applied to detect these higher-level features in data, and then the machine learning
model is trained on these higher-level features. These transformations can take many forms, but for our cat vs. car
example, we might have a feature detector that looks for circles of black pixels, which could be wheels, or the pointy
shape of cat ears. In practice, the features used are rarely quite so human interpretable, but serve the purpose of this
example.

Quantum feature detectors attempt to identify higher-level features in data by transforming that data using quantum
circuits.

Quantum feature detectors can be thought of as having three distinct parts; the encoder, the QFD circuit, and the
decoder. The encoder and decoder are critical components of the QFD, as they form the interface between the quantum
and classical parts of this hybrid algorithm.

The encoder defines the function used to write the classical input data to the quantum circuit. QxQFD expects this to
take the form of a smaller quantum circuit, with the input data determining the form of that circuit. For example, the
EncoderThreshold encoder initializes all qubits to the state, then applies a Not
gate to each qubit that is assigned to input data above a given threshold, effectively moving it to the
state.

The QFD circuit is the actual collection of quantum transformations that will be applied to the encoded data. It is
worth noting that if the circuit does not take advantage of quantum phenomena such as superposition and entanglement, it
may be efficiently simulatable on classical hardware. An easy way to introduce superposition is by using the Hadamard
gate transformation, and entanglement can be introduced by connecting each of your qubits with Controlled-Not gates.

The decoder defines the function used to interpret the circuit’s measurement results as classical data for training a
machine learning model. It can be thought of as a form of classical post-processing. Typically, when a quantum circuit
is measured, the qubit states are extracted as binary bits, but more complex data structures can be considered when
performing multiple circuit runs per QFD evaluation. For example, the DecoderMeasurementSum decoder
finds the most commonly measured state (in case multiple runs were performed), and then counts the number of qubits
measured to in that state and returns that value as the classical output (in this case an integer).
The output of the decoder can take whatever form suits the classical model being trained on the output.

What defines a “good” encoding/decoding methodology will depend on the dataset and the performance metrics for the
problem at hand. In this NISQ (Noisy Intermediate-Scale Quantum hardware) era quantum computing, the challenge is to
design a coding methods that minimize the amount of information lost during the coding process. As an example, the
EncoderThreshold discussed above uses a lot more qubits than the
EncoderQuantumKitchenSinks

QxBranch is a predictive analytics and quantum computing software company founded in 2014, based in Washington DC with
offices in London, UK, and Adelaide, Australia. QxBranch specializes in data analytics services and the development of
quantum computing software.

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.