07 dimensionality reduction

31
Stefano Cavuoti INAF – Capodimonte Astronomical Observatory – Napoli

Transcript of 07 dimensionality reduction

Page 1: 07 dimensionality reduction

Stefano CavuotiINAF – Capodimonte Astronomical Observatory – Napoli

Page 2: 07 dimensionality reduction

By definition, machine learning models are based on learning and self-adaptivetechniques.

A priori, real world data are intrinsically carriers of embedded information, hidden bynoise.In almost all cases the signal-to-noise (S/N) ratio is low and the amount of dataprevents the human exploration. We don’t know which feature of a pattern is muchcarrier of good information and how and where the correlation of features gives thebest knowledge of the solution.

Page 3: 07 dimensionality reduction

If we want to classify the cultivars from which a bottleof wine is made we could analyze a lot of parameters.

• Alcohol• Malic acid• Ash (cenere)• Alcalinity of ash• Magnesium• Total phenols• Flavanoids• Nonflavanoid phenols• Proanthocyanins• Color intensity• Hue• OD280/OD315 of diluted wines• Proline• …• Date of production

The date of production is notrelated to the kind of cultivars andfor this task this parameter isuseless or could be even harmful!

Page 4: 07 dimensionality reduction

The following example is extracted from:http://www.visiondummy.com/2014/04/curse-dimensionality-affect-classification/

Given a set of images, each one depicting either a cat or a dog. We would liketo create a classifier able to distinguish dogs from cats automatically.To do so, we first need to think about a descriptor for each object class thatcan be expressed by numbers, such that a mathematical algorithm can usethose numbers to recognize objects. We could for instance argue that cats anddogs generally differ in color. A possible descriptor discriminating these twoclasses could then consist of three numbers: the average red, green and bluecolors of the images.A simple linear classifier for instance, could linearly combine these featuresto decide on the class labels

If 0.5*red + 0.3*green + 0.2*blue > 0.6 :return cat;

else:return dog;

Page 5: 07 dimensionality reduction

However, these three color-describing numbers, called features, will obviously notsuffice to obtain a perfect classification. Therefore, we could decide to add somefeatures that describe the texture of the image, for instance by calculating the averageedge or gradient intensity in both the X and Y direction. We now have 5 features that,in combination, could possibly be used by a classification algorithm to distinguish catsfrom dogs.To obtain an even more accurate classification, we could add more features, based oncolor or texture histograms, statistical moments, etc.Maybe we can obtain a perfect classification by carefully defining a few hundred ofthese features?The answer to this question might sound a bit counter-intuitive: no, we can’t!.In fact, after a certain point, increasing the dimensionality of the problem, by addingnew features, would actually degrade the performance of our classifier.

This is illustrated by figure, and is often referredto as ‘The Curse of Dimensionality’.

Page 6: 07 dimensionality reduction
Page 7: 07 dimensionality reduction
Page 8: 07 dimensionality reduction
Page 9: 07 dimensionality reduction
Page 10: 07 dimensionality reduction

If we would keep adding features, the dimensionality of thefeature space grows, and becomes sparser and sparser.Due to this sparsity, it becomes much more easy to find aseparable hyperplane because the likelihood that a trainingsample lies on the wrong side of the best hyperplane becomesinfinitely small when the number of features becomesinfinitely large.However, if we project the highly dimensional classificationresult back to a lower dimensional space, we find this:

Page 11: 07 dimensionality reduction

Imagine a unit square that represents the 2D feature space.The average of the feature space is the center of this unitsquare, and all points within unit distance from this center, areinside a unit circle that inscribes the unit square.The training samples that do not fall within this unit circle arecloser to the corners of the search space than to its center.

These samples are difficult to classify because their featurevalues greatly differ (e.g. samples in opposite corners of theunit square). Therefore, classification is easier if most samplesfall inside the inscribed unit circle

Page 12: 07 dimensionality reduction

The volume of the inscribing hypersphere of dimension d andwith radius 0.5 can be calculated as:

Figure shows how the volume of this hypersphere changeswhen the dimensionality increases:

Page 13: 07 dimensionality reduction

The volume of the hypersphere tends to zero as the dimensionality tends toinfinity, whereas the volume of the surrounding hypercube remainsconstant. This surprising and rather counter-intuitive observation partiallyexplains the problems associated with the curse of dimensionality inclassification: In high dimensional spaces, most of the training data residesin the corners of the hypercube defining the feature space. As mentionedbefore, instances in the corners of the feature space are much more difficultto classify than instances around the centroid of the hypersphere. This isillustrated by figure 11, which shows a 2D unit square, a 3D unit cube, and acreative visualization of an 8D hypercube which has 2^8 = 256 corners

Page 14: 07 dimensionality reduction

are not separated in this parameter are separated in this parameter

Page 15: 07 dimensionality reduction
Page 16: 07 dimensionality reduction
Page 17: 07 dimensionality reduction

Pruning of data consists of an heuristic evaluation of quality performance of a machinelearning technique, based on the Wrapper model of feature extraction, mixed withstatistical indicators. It is basically used to optimize the parameter space inclassification and regression problems.

All permutations of data features Regression

• Confusion matrix

• Completeness• Purity• Contamination

• Bias• Standard

Deviation• MAD• RMS• Outlier

percentages

Classification

Page 18: 07 dimensionality reduction
Page 19: 07 dimensionality reduction
Page 20: 07 dimensionality reduction

var A

var B

Page 21: 07 dimensionality reduction

PCA finds linear principal components, based on the Euclidean distance. Itis well suited for clustering problems

Page 22: 07 dimensionality reduction

In order to overcome such kind of limits several methods have beendeveloped based on different principles:• Combination of PCA (segments)• Principal curves,• Principal surfaces• Principal manifolds

Page 23: 07 dimensionality reduction

Feature Selection:• May Improve performance of classification

algorithm• Classification algorithm may not scale up to

the size of the full feature set either insample or time

• Allows us to better understand the domain• Cheaper to collect a reduced set of

predictors• Safer to collect a reduced set of predictors

Page 24: 07 dimensionality reduction

N-N-N-NO TIME, NO TIME, NO TIME! HELLO, GOOD BYE,

I AM LATE, I AM LATE….

JUST TIME FOR A FEW QUESTIONS!

Page 25: 07 dimensionality reduction

Filter model

Wrapper model

Page 26: 07 dimensionality reduction
Page 27: 07 dimensionality reduction
Page 28: 07 dimensionality reduction

The goal here is to have the network "discover" structure in the data by finding how thedata is clustered. The results can be used for data encoding and compression. One suchmethod for doing this is called vector quantization

In vector quantization, we assume there is a codebook which is defined by a set of Mprototype vectors. (M is chosen by the user and the initial prototype vectors arechosen arbitrarily).An input belongs to cluster i if i is the index of the closest prototype (closest in thesense of the normal euclidean distance). This has the effect of dividing up the inputspace into a Voronoi tesselation

Page 29: 07 dimensionality reduction

1. Choose the number of clusters M2. Initialize the prototypes w*1,... w*m (one simple method for doing this is to randomly

choose M vectors from the input data)3. Repeat until stopping criterion is satisfied:

a) Randomly pick an input xb) Determine the "winning" node k by finding the prototype vector that satisfies

|w*k-x|<=|w*i-x| (for all i ) note: if the prototypes are normalized, this isequivalent to maximizing w*i x\

c) Update only the winning prototype weights according tow*k(new) = w*k(old) + m( x - w*k(old) )

LVQ (Learning Vector Quantization) is asupervised version of vector quantization.Classes are predefined and we have a set oflabeled data. The goal is to determine a setof prototypes the best represent each class.

Each output neuron represents a prototypeindependent from each other.Weight update is not extended to neighbours.Does not provide a map.

Page 30: 07 dimensionality reduction
Page 31: 07 dimensionality reduction

LVQ network: is a hybrid supervised network where the clustered space (through SOM)is used to take a classification decision, in order to compress (categorize) the inputinformation