Quantum-inspired Classification Process Giuseppe Sergioli & - - PowerPoint PPT Presentation

quantum inspired classification process
SMART_READER_LITE
LIVE PREVIEW

Quantum-inspired Classification Process Giuseppe Sergioli & - - PowerPoint PPT Presentation

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation Quantum-inspired Classification Process Giuseppe Sergioli & Alophis group (Applied Logics,


slide-1
SLIDE 1

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation

Quantum-inspired Classification Process

Giuseppe Sergioli & Alophis group (Applied Logics, Philosophy and History of Science) University of Cagliari

[giuseppe.sergioli@gmail.com]

November 3th-4th, Cagliari

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process

slide-2
SLIDE 2

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation

Univeristy of Cagliari Department of Philosophy Department of Electronic Engineering Project: "Modelling the Uncertainty: Quantum Theory at the service of Pattern Recognition"

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process

slide-3
SLIDE 3

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation

List of contents

◮ Basic notions ◮ A Quantum representation of NMC ◮ Inspired Quantum Pattern Recognition on a Classical

Computer

◮ Non-invariance under rescaling: from an Embarrassment

to an Asset

◮ Some practical implementation

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process

slide-4
SLIDE 4

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation Training set, Class, Pattern, Feature Nearest Mean Classifier (NMC)

Training set, Class, Pattern, Feature

Let us consider (as a simple example) two disjoint sets A and B

  • f different objects (say cats and dogs). During the training

set, we take n objects from the set A and m objects from the set B. Let Ca ⊂ A and Cb ⊂ B. We can measure two (or more) features of each object ai ∈ Ca and bi ∈ Cb (for istance the weight and the lenght of the tail). We say that Ca and Cb are classes and the objects ai and bi are patterns that are characterized by their features. We write, for example, ai = {x1, x2}, where x1 and x2 are the weight and the lenght of the tail of the cat ai, respectively.

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process

slide-5
SLIDE 5

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation Training set, Class, Pattern, Feature Nearest Mean Classifier (NMC)

Nearest Mean Classifier (NMC)

Let us consider the classes Ca = {a1, ..., an} and Cb = {b1, ..., bm}, with ai and bi belonging to the training set and an arbitrary pattern ci = {x1, x2} belonging to the test set. The goal is to establish whether is more probably that ci ∈ A or ci ∈ B. We - only - consider the centroids a∗ and b∗ of Ca and Cb and the euclidean distances Ed(ci, a∗) and Ed(ci, b∗). Hence, if Ed(ci, a∗) ≥ Ed(ci, b∗) then (is more probabily that) ci ∈ B; otherwise ci ∈ A.

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process

slide-6
SLIDE 6

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation Training set, Class, Pattern, Feature Nearest Mean Classifier (NMC)

The notions of "Pattern" and "Classification" are very general and are naturally connected to our common processes of acquiring knowledge.

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process

slide-7
SLIDE 7

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation How to encode a Pattern as a Density operator Normalized Trace Distance

All we need in order to provide a Quantum representation of NMC are:

◮ a sutable encoding from patterns to quantum objects ◮ a quantum counterpart of the centroid ◮ a quantum counterpart of the Euclidean distance

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process

slide-8
SLIDE 8

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation How to encode a Pattern as a Density operator Normalized Trace Distance

An Example: Stereographic encoding

It is possible to map the pattern a = (x, y) onto the surface of a radius one sphere by the stereographic projection: (x, y) → ( 2x x2 + y2 + 1, 2y x2 + y2 + 1, x2 + y2 − 1 x2 + y2 + 1). By placing the Bloch components: r1 =

2x x2+y2+1; r2 = 2y x2+y2+1; r3 = x2+y2−1 x2+y2+1 we obtain:

ρa = 1 2

  • 1 + r3

r1 − ir2 r1 + ir2 1 − r3

  • =

1 x2 + y2 + 1

  • x2 + y2

x − iy x + iy 1

  • .

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process

slide-9
SLIDE 9

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation How to encode a Pattern as a Density operator Normalized Trace Distance

Example

Let us consider the pattern a = {1, 3}. Its corresponding Density pattern ρa, is: ρa = 1 11

  • 10

1 − 3i 1 + 3i 1

  • We call ρa Density Pattern.

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process

slide-10
SLIDE 10

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation How to encode a Pattern as a Density operator Normalized Trace Distance

Moon Dataset

1.0 0.5 0.0 0.5 1.0 1.5 2.0 1.5 1.0 0.5 0.0 0.5 1.0 1.5

Figure : Classical Patterns

1.0 0.5 0.0 0.5 1.0 1.0 0.5 0.0 0.5 1.0 1.0 0.5 0.0 0.5 1.0

Figure : Density Patterns

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process

slide-11
SLIDE 11

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation How to encode a Pattern as a Density operator Normalized Trace Distance

Another Example: Projective encoding

v ≡ (x, y) → ( x ||v||, y ||v||) ≡ (¯ x, ¯ y) |ψv = ¯ x|0 + ¯ y|1 ρv = |ψvψv| ...and many others.

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process

slide-12
SLIDE 12

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation How to encode a Pattern as a Density operator Normalized Trace Distance

Preservation of the Order

Let a = {xa, ya} b = {xb, yb} and c = {xc, yc} be three arbitrary patterns and let ρi be the density pattern associated to the pattern i. If Ed(a, b) ≤ Ed(b, c) (where Ed is the Euclidian distance), is it possible to define a Quantum distance such that Qd(ρa, ρb) ≤ Qd(ρb, ρc)?

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process

slide-13
SLIDE 13

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation How to encode a Pattern as a Density operator Normalized Trace Distance

Normalized Trace Distance

Let us consider two patterns a = {xa, ya} and b = {xb, yb}. Let ρa = 1

2

  • 1 + ra3

ra1 − ira2 ra1 + ira2 1 − ra3

  • the density pattern

associated to a; similarly for b. Let place K =

2

(1−ra3)(1−rb3) and let we define the normalized

trace distance as: K Td(ρa, ρb), where Td is the usual Trace distance. It is straightforward to show that Ed(a, b) = K Td(ρa, ρb).

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process

slide-14
SLIDE 14

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation How to encode a Pattern as a Density operator Normalized Trace Distance

Classification

Hence, given a and b as the centroids of Ca and Cb respectively, if K Td(ρx, ρa) ≥ K Td(ρx, ρb) then x ∈ B; otherwise x ∈ A. Similarly to the classical case.

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process

slide-15
SLIDE 15

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation How to encode a Pattern as a Density operator Normalized Trace Distance

Convenience on a Quantum Computer

Quoting S. Lloyd, M. Mohseni and P . Rebentrost (Quantum algorithms for supervised and unsupervised machine learning - arXiv:1307.0411; 2013) "Estimating distances between vectors in N-dimensional vector spaces then takes time O(logN) on a quantum computer. By contrast, sampling and estimating distances between vectors

  • n a classical computer is apparently exponentially hard.

Quantum machine learning provides an exponential speed-ups

  • ver all known classical algorithms for problems involving

evaluating distances between large vectors." But it turns out to be convenient mostly on a Classical Computer...

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process

slide-16
SLIDE 16

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation Quantum Centroid Comparison

Quantum Centroid

Given a dataset {P1, ..., Pn}, let us consider the respective set

  • f density patterns {ρ1, ..., ρn}.

The Quantum Centroid is defined as: ρQC = 1 n

n

  • i=1

ρi.

  • S. Gambs, Quantum classification, arXiv:0809.0444v2.

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process

slide-17
SLIDE 17

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation Quantum Centroid Comparison

Observations

Some observation:

◮ The QC ρQC is not a pure state and it has not any

counterpart in the set of classical pattern in Rn;

◮ In contrast to the Classical Centroid, the QC is "sensitive"

to the distribution of the patterns.

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process

slide-18
SLIDE 18

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation Quantum Centroid Comparison

We provide a comparison between the NMC and the "quantum" classification process based on Density Patterns and Quantum Centroids by involving different kinds of standard datasets on a Classical Computer. We compare the Error E and the reliability (in terms of the Cohen’s constant k) for both classifiers. At a first glance - and in order to provide a clear visual representation - we consider that the training and the test sets are the same.

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process

slide-19
SLIDE 19

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation Quantum Centroid Comparison

Gaussian Dataset

Gaussian Dataset: 200 Patterns allocated in two Classes.

Figure : Gaussian Dataset Figure : NMC Figure : Quantum Classifier

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process

slide-20
SLIDE 20

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation Quantum Centroid Comparison

Table : Gaussian Dataset

E E1 E2 Pr k TPR FPR NMC 0.445 0.41 0.48 0.555 0.11 0.555 0.445 QC 0.24 0.28 0.2 0.762 0.52 0.76 0.24 By randomly dividing the dataset in a training set (80%) and in a test set (20%), the average over 100 experiments gives: NMC − Error = 44.35 ± 6.79; Q − Error = 23.68 ± 6.09.

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process

slide-21
SLIDE 21

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation Quantum Centroid Comparison

A remark

Even if the error of the Quantum Classifier is lower than the Error of the NMC, there are some patterns that are correctly classified by the NMC but not by the Quantum Classifier. Hence, it makes sense to consider a "merging" of the NMC and the Quantum Classifier.

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process

slide-22
SLIDE 22

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation Quantum Centroid Comparison

Gaussian Dataset

Figure : Gaussian Dataset Figure : NMC Figure : Quantum Classifier Figure : NMC & Quantum Classifier

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process

slide-23
SLIDE 23

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation Quantum Centroid Comparison

Table : Gaussian Dataset

E E1 E2 Pr k TPR FPR NMC 0.445 0.41 0.48 0.555 0.11 0.555 0.445 QC 0.24 0.28 0.2 0.762 0.52 0.76 0.24 NMC-QC 0.13 0.14 0.12 0.87 0.74 0.87 0.13

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process

slide-24
SLIDE 24

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation Quantum Centroid Comparison

Moon Dataset

Moon Dataset: 200 patterns allocated in two Classes.

Figure : Moon Dataset Figure : NMC Figure : Quantum Classifier Figure : NMC & Quantum Classifier

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process

slide-25
SLIDE 25

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation Quantum Centroid Comparison

Table : Moon Dataset

E E1 E2 Pr k TPR FPR NMC 0.22 0.22 0.22 0.78 0.56 0.78 0.22 QC 0.18 0.14 0.22 0.822 0.64 0.82 0.18 By randomly dividing the dataset in a training set (80%) and in a test set (20%), the average over 100 experiments gives: NMC − Error = 22.32 ± 6.32; Q − Error = 17.85 ± 5.46.

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process

slide-26
SLIDE 26

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation Quantum Centroid Comparison

Banana Dataset

Banana Dataset: 5300 patterns; 2376 belonging to the first Class and 2924 to the second Class.

Figure : Banana Dataset Figure : NMC Figure : Quantum Classifier Figure : NMC & Quantum Classifier

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process

slide-27
SLIDE 27

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation Quantum Centroid Comparison

Table : Banana Dataset

E E1 E2 Pr k TPR FPR NMC 0.447 0.423 0.468 0.554 0.108 0.555 0.445 QC 0.418 0.382 0.447 0.585 0.168 0.585 0.415 NMC-QC 0.345 0.271 0.406 0.661 0.317 0.662 0.338 By randomly dividing the dataset in a training set (80%) and in a test set (20%), the average over 100 experiments gives: NMC − Error = 44.88 ± 1.74; Q − Error = 41.57 ± 1.21.

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process

slide-28
SLIDE 28

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation Quantum Centroid Comparison

3Gaussian Dataset

3Gaussian Dataset: 450 Patterns allocated in three Classes.

Figure : 3Gaussian Dataset Figure : NMC Figure : Quantum Classifier Figure : NMC & Quantum Classifier

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process

slide-29
SLIDE 29

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation Quantum Centroid Comparison

Here we randomly divide the dataset in a Training set (80% of the patterns) and a Test set (20% of the patterns). We calculate the average over 100 runs for each experiments.

A full comparison

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process

slide-30
SLIDE 30

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation

The Quantum Centroid is not invariant under rescaling → the "Quantum" Classifier is not invariant under rescaling! Is it an Embarrasment or is it an Asset? The Error is dependent on both the rescaling of the Patterns and the different encoding. We show how the Error changes by changing the rescaling and for two different encodings.

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process

slide-31
SLIDE 31

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation

Rescaling

How the Error of the Quantum Classifier changes by ranging the value of the rescaling.

Figure : Accuracy and Rescaling

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process

slide-32
SLIDE 32

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation

Further developments

As further developments, it will be checked whether the Quantum Classifier could bring some benefit for practical implementations, such as

Figure : Handwriting Figure : Fingerprint Recognition Figure : Face Recognition Figure : Biomedical Imaging

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process

slide-33
SLIDE 33

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation

Observations and Open Problems

◮ The choise of the "best" Encoding (and/or the best

Rescaling) is mostly empirical and it is stritcly dependent

  • n the Database (No Free Lunch Theorem).

◮ A comparison with more performant classifiers (Linear

Discriminant Analysis, Quadratic Discriminant Analysis ...) could be investigated. The NMC and the Quantum Classifier are based on the concepts of centroid and distance only. Suggestions are wellcome!

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process

slide-34
SLIDE 34

Basic Notions A Quantum representation of NMC Quantum Pattern Recognition on a Classical Computer Using the rescaling Some practical implementation

  • G. Sergioli, E. Santucci, L. Didaci, J.A. Miskczak, R. Giuntini,

Pattern Recognition on the Bloch Sphere, arXiv:1603.00173 (2016).

Giuseppe Sergioli & Alophis group Quantum-inspired Classification Process