Download presentation

Presentation is loading. Please wait.

Published byAhmad Bunkley Modified over 2 years ago

1
Pre-processing Idea: XOXOXOXOXOXO XXXOOOXXXOOO Pre-processing Post-processing Network Input data Output data Pre-processing is good to use with networks since the network training => pre-processing does not need to be exact

2
Why Pre-process? Although in principle networks can approximate any function in practice its easier if pre-processing is performed first Types of pre-processing: 1. Linear transformations e.g input normalisation 2. Dimensionality reduction loss of info. Good pre-proc => lose irrelevant info and retain salient features 3. Incorporate prior knowledge look for edges / translational invariants

3
4. Feature extraction use a combination of input variables: can incorporate 1, 2 and 3 5. Feature selection decide which features to use

4
b e.g. Character recognition For a 256 x 256 character we have 65, 536 pixels. One input for each pixel is bad for many reasons: 1.Poor generalisation: data set would have to be vast to be able to properly constrain all the parameters (Curse of Dimensionality) 2.Takes forever to train Answer: use e.g. averages of N 2 pixels dimensionality reduction – each average could be a feature. Which ones to use (select)? Use prior knowledge of where salient bits are for different letters

5
Be careful not to over-specify e.g if X was in one of k classes could use the posterior probabilities P(C k | X) as features. Therefore, in principle only k-1 features are needed. In practice, its hard to obtain P(C k | X) and so we would use a much larger number of features to ensure we don’t throw out the wrong thing Notice that the distinction between network training and pre-proc. is artificial: If we got all the posterior probs. the classification is complete. Leave some work for the network to do.

6
Input normalisation Useful for RBFNs (and MLPs): if variation in one parameter is small with respect to the others it will contribute very little to distance measures (l + ) 2 ~ l 2. Therefore, preprocess data to give zero mean and unit variance via simple transformation: x* = (x - )

7
However, this does not take into account correlations in the data. Can be better to use whitening (Bishop, 1995, pp )

8
Eigenvectors and eigenvalues If : Ax = x For some scalar not = to 0, then we say that x is an eigenvector with eigenvalue. Clearly, x is not unique [e.g. if Ax = x, A2x = x], so it is usual to scale x so that it has unit length. Intuition: direction of x is unchanged by being transformed by A so it in some sense reflects the principal axis of the transformation.

9
Eigenvector Facts If the data is D-dimensional there will be D eigenvectors If A is symmetric (true if A is the covariance matrix), the eigenvectors will be orthogonal and unit length so: x i T x j = 1 if i = j x i T x j = 0 else This means that the eigenvectors form a set of basis vectors. That is, any vector can be expressed as a linear sum of the eigenvectors.

10
Let U be a matrix whose columns are the eigenvectors u i of , and a matrix with the corresponding eigenvalues i on the diagonals i.e: U = (u 1, … …, u n ) And: diag( 1, ……, n ) So:AU = U Because of orthogonality of the eigenvectors U is orthonormal I.e: U T U = U -1 U = I (that is diag( , ……, )) Thus we have the orthogonal similarity transformation: U T AU = U T U = By which we can transform A into a diagonal matrix

11
Also if A is the covariance matrix of multivariate normal data, eigenvectors/eigenvalues reflect the direction and extent of variation ie 1 u 1 2 u 2 Standard deviation in each direction = eigenvalue

12
If A is diagonal, eigenvectors are oriented along the axes If A is the identity, A is circular

13
x* = -1/2 U T (x - where U is a matrix whose columns are the eigenvectors u i of , the covariance matrix of the data, and a matrix with the corresponding eigenvalues i on the diagonals and is the mean of the data Why? Because the new covariance matrix will be approximately the identity matrix 1 u 1 2 u 2 Whitening

14
Dimensionality Reduction Clearly losing some information but this can be helpful due to curse of dimensionality Need some way of deciding what dimensions to keep 1.Random choice 2.Principal components analysis (PCA) 3.Independent components analysis (ICA) 4.Self-organised maps (SOM) etc

15
Random subset selection Any suitable algorithm can be used especially ones used in selecting number of hidden units Sequential forward search Sequential backward search Plus-l take away r etc

16
Principle Components Analysis Transform the data into a lower dimensional space but lose as little information as possible Project the data onto unit vectors to reduce the dimensionality of the data. What vectors to use? x* = x T y = y T x y || y || = 1 x

17
Want to reduce the dimensionality of x from d to M 1 u 1 2 u 2 x x x x x x x x

18
Therefore to minimise E we discard the dimensions with the smallest eigenvectors

19
PCA can also be motivated from considerations of the variance along an axis specified by the eigenvectors

20
PCA procedure: 1.Given a data set X = {x 1, … …, x N } normalise the data (minus mean and divide by the std deviation) and calculate the covariance matrix C 2.Calculate the eigenvalues i and eigenvectors u i of C and order them from 1 to d in decending order starting with the largest eigenvalue 3.Discard the last d-M dimensions and transform the data via: Ie z i are the principal components (NB some books refer to the u i as the principal components)

21
Why use input normalisation? Must subtract the mean vector as the theory requires that the data are centred at the origin Also, we divide by the standard deviation as we must do something to ensure that input dimensions with a large range do not dominate the variance terms Why not use whitening? Since this removes the correlations that we are trying to find and makes all the eigenvalues similar

22
Here the data is best viewed along the dimension of the eigenvector with the most variance as this shows the 2 clusters clearly Should result in losing unnecessary information

23
Here projecting the data onto u 1, the eigenvector with the most variance, loses all discriminatory information But it is not guaranteed to work …

24
Finally: How to decide M ie how many/which dimensions to leave out? This may be decided in advance due to constraints on processing power Another technique (used in eg Matlab) is to look at the contribution to the overall variance of each principal component and leave out any dimensions which fall below a certain threshold As ever, no one answer: may just want to try a few combinations or could even keep them all

25
PCA is very powerful in practical applications. But how do we compute eigenvectors and thus principal components in real situations? Basically two ways: Batch and sequential We have seen the batch method, but this can be impractical if the dimensionality or no. of data points is too large Also in a nonstationary environment, sequential can track gradual changes in the data It requires less storage space Sequential mode is used in modelling self-organization It mimics Hebbian learning rule …

26
Hebbian Learning Ie if Hebb's postulate of learning (or simply Hebb's rule) (1949), is the following: "When an axon of cell A is near enough to excite cell B and repeatedly or persistently takes part in firing it, some growth processes or metabolic changes take place in one or both cells such that A's efficiency as one of the cells firing B, is increased". then However, simple hebbian learning cause uncontrolled growth of weights to a max value so need to impose a normalisation constraint Where is a +ve constant: known as Oja’s rule (1982) which makes |w| 2 gradually relax to 1/ – form of competition between synapses

27
In this way networks can exhibit selective amplification if there is one dominant eigenvector (cf PCA) How can such precise tuning come about? Hebbian learning

28
Relationship between PCA and Hebbian learning Consider a single neuron with a Hebbian learning rule: Oja’s learning rule (Oja, 1982) : w i (t+1) = w i (t)+ y(t) (x i (t) –y 2 (t) w i (t)) Where y(t) x i (t) is the Hebbian term and – y 2 (t) w i (t) is the normalisation term which avoids uncontrolled growth of the weights (=> ||w|| = 1 at convergence) w 1 (t) output y(t) = w T (t) x(t) input x(t) w d (t)

29
This can be shown to have a stable minimum at C w = 1 w Where C is the the covariance matrix of the training data. Result: w(t) converges to w the eigenvector of C which has the largest eigenvalue 1. The output is therefore : y = w T x = u 1 T x Ie the first principal component of C Thus a single linear neuron with a Hebbian learning rule can evolve into a filter for the first principal component Intuitively, consider the 1D case: here the eigenvector w is either 1 or –1. At convergence of Oja’s learning rule we have: y(t) (x -y(t) w (t))=0 which is satisfied if w(t)=1 or -1

30
We now introduce a special PCA learning rule called APEX developed by Kung and Diamantaras, This is a generalisation of the single neuron case to multiple neurons where the outputs are connected via inhibitory links w 11 (t) output j: y j (t) = w j T (t) x(t) + a j T (t) y j-1 (t) input x(t) w 1d (t ) w dd (t ) a j1 (t) a jd (t) y 1 (t) y 2 (t ) Where we define the feedback vector: y j-1 = [y 1 (t), y 2 (t), … y j-1 (t)] W j (t) = [w j1 (t), w j2 (t), … w jd (t)] and a j (t) = [a j1 (t), a j2 (t), … a jd (t)]

31
Where the update rules for w j and a j are: w j (t+1) = w j (t) + y j (t) (x(t) - y 2 j (t) w j (t)) (Hebbian + normalisation) a j (t+1) = a j (t) - y j (t)(y j-1 (t)+y 2 j (t) a j (t)) (anti-Hebbian (inhibitory) + normalisation) Procedure to find the y i (ie the principal components) is analogous to proof by induction: if we have found (y 1, y 1, … y i-1 ) we can determine the feedback vector: y i-1 (t)=[y 1 (t),...., y j-1 (t)]

32
Apex algorithm 1. Initialize the feedforward weight vector w j and the feedback weight vector a j to small random values at time t = 1, where j = 1, 2, …, d. Assign a small positive value for 2. Set j=1 and compute the first principal component y 1 as for the single neuron ie for t = 1, 2, 3, … compute: y 1 (t) = w 1 T (t) x(t) w 1 (t+1) = w 1 (t)+ y 1 (t) (x(t) - y 1 (t) w 1 (t)) (Continued overleaf …)

33
3.Set j=2 and for t = 1, 2, 3, … compute: y j-1 (t)=[y 1 (t),...., y j-1 (t)] (the feedback) y j (t) = w j T (t) x(t) + a j T (t) y j-1 (t) w j (t+1) = w j (t) + y j (t) (x(t) - y j (t) w j (t)) a j (t+1) = a j (t) - y j (t)(y j-1 (t)+y j (t) a j (t)) 4. Increase j by 1 and go to step 3. Repeat till j = M the desired number of dimensions

34
Theoretically, PCA is the optimal (in terms of not losing information) way to encode high dimensional data onto a lower dimensional subspace Can be used for data compression where intuition is that getting rid of dimensions with little variance gets rid of noise

35
Independent Components Analysis (ICA) As the name implies, an extension of PCA but rooted in information theory. Starting point: suppose we have the following situation: Source vector u(n) Mixer A Demixer W Observation vector x(n) Output vector y(n) Unknown environment

36
That is we have a number of vectors of values (indexed by n eg data at various time-steps) generated by d independent sources u(n) = (u 1 (n), …, u d (n) ) (assumed to have zero mean) which have been mixed by a d x d matrix A to give a vector of observations: x(n) = (x 1 (n), …, x d (n) ) (also zero mean as u zero mean). That is: x (n) = A u (n) Where A and u(n) are unknown. The problem is to recover u when all we know (all we can see) are the observation vectors x Problem therefore known as blind source separation

37
Example: u 1 (t) = 0.1 sin (400 t )cos( 30 t) u 2 (t) = sign (sin(500 t+ 9cos (40 t))) u 3 (t) = uniformally distributed noise in the range [-1,1] x 1 (t) = 0.56 u 1 (t) u 2 (t) u 3 (t) x 2 (t) = u 1 (t) u 2 (t) u 3 (t) x 3 (t) = 0.17 u 1 (t) u 2 (t) u 3 (t) Problem: we receive signals x(t), how do we recover u(t)?

38
u 1 (t) u 2 (t) u 3 (t)

39
x 1 (t) x 2 (t) x 3 (t)

40
To solve this we need to find a matrix W such that: y(n) = W x(n) with the property that u can be recovered from the outputs y. Thus the blind source separation problem can be stated as: Given N independent realisations of the observation vector x, find an estimate for the inverse of the mixing matrix A since : y(n) = W x(n) = A -1 x(n) = A -1 A u(n) = u(n)

41
Neurobiological correlate: the cocktail party problem The brain has the ability to to selectively tune to and follow one of a number of (independent) voices despite noise, delays, water in your ear lecturer droning on etc etc Very many applications including: Speech analysis for eg teleconferencing Financial analysis: extract the underlying set of dominant components Medical sensor interpretation: eg separate a foetuses heartbeat from the mothers (Sussex) neuroscience (Ossorio, Baddeley and Anderson): analysis of cuttlefish patterns. Try to find an underlying alphabet/language of patterns used to convey information

42
Use Independent Component Analysis (Comon, 1994) Can be viewed as an extension of PCA as both aim to find linear sums of components to re-represent the data In ICA, however, we impose statistical independence on the vectors found and lose the orthogonality constraint Definition: random variables X and Y are statistically independent if joint probability density function can be expressed as a product of the marginal density functions (ie pdf’s of X and Y as if they were on their own): f(x, y) = f(x) f(y) [NB discrete analogy: if A and B are independent events then: P(A and B) = P(A, B) = P(A) P(B)]

43
PCA ICA PCA good for gaussian data, ICA good for non gaussian as indpendence => non-gaussianity In fact, independent components MUST be nongaussian (more interesting distributions if non-gaussian) and to get components we maximise the non-gaussianity (the kurtosis) of the data Why? Because a linear sum of gaussians is itself gaussian and one cannot distinguish the components from the mixture model

44
Young field (mid 90’s), still developing, somewhat in concurrence with kernel techniques (eg kernel PCA and kernel ICA: find non- linear combinations of components to represent the data) Need some measure of statistical independence of X and Y: Can use mutual information I(X, Y) Concept from information theory: defined in terms of entropy which is a measure of the average amount of information a variable conveys, or analogously our uncertainty about the variable If X is the system input and Y the system output, the mutual information I(X, Y) is the difference in our levels of uncertainty about the system input (it’s entropy) before and after observing the system output. Thus if : I(X, Y) = 0 X and Y are statistically independent [or intuitively: no information about X from Y and vice versa => X, Y independent]

45
Idea, therefore is to minimise the mutual info I(y i,, y j ) between all pairs I and j of the outputs (which we want to be equal to the original inputs which are independent) This is equivalent to minimising the Kullback-Leibler (KL) divergence which measures the difference between the joint pdf f(y,W) and the product of the marginal densities f(y i,W) with respect to W. Thus we have (a variant of) the Infomax Principle (Comon): Given a d-by-1 vector x representing a linear combination of d independent source signals, the transformation of the observation vector x by a neural system into a new vector y should be carried out in a way that the KL divergence between the paramaterised probability density function f(y,W) and the product of the marginal densities f(y i,W) is minimised with respect to the unknown parameter matrix W

46
Which after some hard maths (Haykin and other bits of chapter 10) leads us to the following algorithm for finding W W(n +1) - W(n)= ( n) [I - (y(n))y T (n)] W(n) where: (y) = [ (y 1 ), (y 2 ), …, (y m )] T And: NB must be chosen to be sufficiently small for stability of the algorithm (see Haykin). Many other versions are available (FastICA seems quite good) Return to the problem described earlier …

47
u 1 (t) = 0.1 sin (400 t )cos( 30 t) u 2 (t) = sign (sin(500 t+ 9cos (40 t))) u 3 (t) = uniformally distributed noise in the range [-1,1] x 1 (t) = 0.56 u 1 (t) u 2 (t) u 3 (t) x 2 (t) = u 1 (t) u 2 (t) u 3 (t) x 3 (t) = 0.17 u 1 (t) u 2 (t) u 3 (t) Problem: we receive signals x(t), how do we recover u(t)?

48
u 1 (t) u 2 (t) u 3 (t)

49
x 1 (t) x 2 (t) x 3 (t)

50
Using the blind separation learning rule starting from random weights in the range [0, 0.05], =0.1, N=65000, timestep = 1x 10 -4, batch version of algorithm for stability (Haykin, p.544): W(0)= W(t) converges to around t= where WA ~ W is almost an inverse of A (with scaling of the original signals as the solution not unique) and so the signal is recovered

51
Components can only be estimated up to a rescaling (since if x is a component multiplied by a, then 2x multiplied by a/2 is also a component Note that this means we often get –x instead of x

52
Must pre-process before performing ICA to give the data zero mean Also helps to whiten the data as it makes the mixing matrix orthogonal which means there are less parameters to estimate (since A T = A) Often good to reduce the dimensionality (via PCA etc) to get rid/reduce noise Pre-processing in ICA

53
ICA example 2: Original Sources

54
ICA Example 2: Mixed images

55
ICA Example 2: PCA/whitened images

56
ICA Example 2: Extracted components

57
ICA Example 2: rescaling of –ve components

58
Example 1: Speech - Music Separation A speaker has been recorded with two distance talking microphones (sampling rate 16kHz) in a normal office room with loud music in the background. The distance between the speaker, cassette player and the microphones is about 60cm in a square ordering. Microphone 1 Microphone 2 Separated source 1 Separated source 2

59
2. Speech - Speech Separation A real Cocktail Party Effect. Two Speakers have been recorded speaking simultaneously. Speaker 1 says the digits from one to ten in English and speaker 2 counts at at the same time the digits in Spanish (uno dos... ) The recording has been done in a normal office room. The distance between the speakers and the microphones is about 60cm in a square ordering Microphone 1 Microphone 2 Separated source 1 Separated source 2

60
3. Speech - Speech Separation in difficult environments A real Cocktail Party Effect II. Two Speakers have been recorded speaking simultaneously. This time the recording was in a conference room ( 5.5m by 8m ). The conference room had some air- conditioning noise. Both speakers are reading a section from the newspaper for 16sec. The mics were placed 120 cm away from the speakers. The unmixing filters need to be sufficiently long. We used a filter size of 2048 taps for each filter. Microphone 1Microphone 2 Separated source 1Separated source 2

61
Pre-processing for time series Problem: prediction of time series data ie sequence of measurements taken at regular time intervals. e.g. share price, weather forecast, speech signals etc Take 1D case for simplicity, x(t): network attempts to approximate the x(t) from the previous d outputs [x(t - d), …, x(t –1)] used as inputs: one-step ahead prediction Could try to predict more steps ahead (multi-step ahead prdeiction) but the errors tend to accumulate quickly and such efforts are usually characterised by a sharp decrease in performance

62
Here we are attempting to fit the static function which is underlying the fluctuations That is, if there is a general trend (eg increase with time) we want to remove it: de-trending That is, we first attempt to fit a simple (eg linear) function of time to the data and then take this away from the inputs However, if the trend itself evolves with time this is inappropriate and on-line techniques are needed to track the data. How to do this well is an open research issue

63
Prior knowledge can also be used to improve network training and performance Several ways of incorporating prior knowledge eg invariances 1. If we know the network is invariant to some transformations of the data we could ‘pre-process’ the data set X by forming invariants of members of the data set and adding them to a new data set X* however, this can quickly lead to very large data sets 2. Simply ‘remove’ invariant points by pre-processing If we are classifying lists of properties and the order is unimportant, pre-process the data so that the lists are all mapped to a unique ordering, eg alphabetical

Similar presentations

© 2016 SlidePlayer.com Inc.

All rights reserved.

Ads by Google