Linear Classifiers Rubine & CA-Linear Ruben Balcazar

Preview:

Citation preview

Linear ClassifiersRubine & CA-Linear

Ruben Balcazar

Classification Task

Given a group of labels, can we identify an input as belonging to one of those labels?

To be more concrete LABELS

Cat

Dog

INPUT

?

To be more concrete LABELS

Cat

Dog

INPUT

How could we make a machine that could do these classifications?

Features

Qualities that can describe and differentiate our labels:• Size• Weight• Fluffiness• Appetite• Time spent sleeping

One Feature

Size

One Feature

Size

Training Set

One Feature

Size

?Input

One Feature

Size

Input

Two Feature

Size

Appetite

Two Feature

Size

Appetite

Two Feature

Size

Appetite

Good Linear Classifier

Two Feature

Size

Appetite

Bad Linear Classifier

Features Vector

Allows us to represent any number of n features:

𝑓 < 𝑓 1 , 𝑓 2 ,…, 𝑓 𝑛>¿

Weights

Not every feature is equally important!

Every feature f has an associated weight w to reflect how much it contributes to classification.

Weights are found through the use of training sets.

Evaluation Score

𝑆𝑐𝑜𝑟𝑒=𝑤0+∑ 𝑓 𝑖𝑤𝑖In two class(label) systems, score works as a threshold: In more complex systems, the class with the highest

score is the best match.

In gesture recognition, our classes are the different gesturetypes.

RubineFeature are extracted from gesture point data:

Example:

Feature 1 is the cosine of the initial angle of the gesture.

Feature 4 is the angle of the diagonal of the gesture’s bounding box.

Rubine specifies 13 features total.

RubineGiven a:• Feature vector f<f1,f2, … ,fF> where F = total # of

features for an input gesture g.• Gesture class c’ and C = total # of classes what contain

F amount of weights.

Finding the Weights

Assume we have a training set with E amount of examples for class c’:

Calculate the average of each feature in a class c’:

Finding the Weights

Estimate a sample covariance(COV) matrix for gesture class c’

COV matrix is F x F

Finding the Weights

Common Covariance (CCOV) for ALL gesture classes

𝐶𝐶𝑂𝑉 11 𝐶𝐶𝑂𝑉 12 𝐶𝐶𝑂𝑉 13

𝐶𝐶𝑂𝑉 21 𝐶𝐶𝑂𝑉 22 𝐶𝐶𝑂𝑉 23

𝐶𝐶𝑂𝑉 31 𝐶𝐶𝑂𝑉 32 𝐶𝐶𝑂𝑉 33

CCOV is also an FxF matrix

Finding the Weights

Invert the CCOV matrix : CCOV-1

Remember: An inverse of a matrix A is a matrix A-1 such that:

AA-1 = <- Identity Matrix

Finding the Weights

Finally, we can find the weights via:

For Reference:

Finding the Weights

The Constant Weight:

For Reference:

RejectionLABELS

Cat

Dog

INPUT

Linear Classifiers ALWAYS return a class.

RejectionLABELS

Cat

Dog

INPUT

?What if our input is not relevant?

RejectionLABELS

Cat

Dog

INPUT

Ruben is a dog?

RejectionLABELS

Cat

Dog

INPUT

Ambiguous or irrelevant classifications should be rejected.

Rejection in Rubine

Given a gesture g with a feature vector f classified as class i with an evaluation score vi:

Reject Classification if < 0.95.

CA-Linear

CA-Linear is a modification of Rubine.

CA stands for “Context Aware.”

CA-Linear uses “context” to remove potential gesture candidates from a classification.

Context : First Modification

𝑣𝑐 ′=𝑤𝑐 ′ 0+∑𝑖=1

𝐹

(𝑤 ¿¿𝑐 ′ 𝑖) ( 𝑓 𝑔𝑖 )0≤𝑐 ′<𝐶 ¿

Rubine:

𝑣𝑐 ′=¿CA-Linear:

Context is denoted by I, an indicator or relative context function.

ParKorror’s Context

Player Context:

Environmental context:

𝐼𝑔 :Φ×Ψ→𝑅0+¿¿

Gesture Prior Function: Second ModificationEach supported gesture g out of a set of G gestures is given a probability of occurring in a given context I as:

In ParKorror: 𝑃 (𝑔|𝐼 ¿=𝐼𝑔(Φ,Ψ )

∑𝑖∈ 𝐺

𝐼𝑖 (Φ,Ψ )

Gesture Prior Function: Second ModificationRubines:Common Covariance (CCOV) for ALL gesture classes

CA-Linear:

Summary:

Rubine:• Gesture is defined by a features vector• The supported gestures use examples(training sets) to calculate the weight of

these features using CCOV matrixes• Input gestures are classified by evaluation equation

• The highest evaluation score is the classified gesture• We reject classification if P(g|c) < 0.95.

𝑣𝑐 ′=𝑤𝑐 ′ 0+∑𝑖=1

𝐹

(𝑤 ¿¿𝑐 ′ 𝑖) ( 𝑓 𝑔𝑖 )0≤𝑐 ′<𝐶 ¿

SummaryCA-Linear:• Identical to Rubine with the exception of the addition of Context and

the Gesture Prior Function• Context is used to remove irrelevant gestures from classification:

• The Gesture Prior Function defines the probability of gesture being correctly classified in a given context and is used to create a context aware CCOV matrix to obtain the weights of each feature:

𝑣𝑐 ′=¿

Questions?

Recommended