当前位置:文档之家› 核fisher算法

核fisher算法

核fisher算法
核fisher算法

Fisher Kernel

Martin Sewell

Department of Computer Science

University College London

April2007(last updated September2008)

1Introduction

In common with all kernel methods,the support vector machine technique in-volves two stages:?rst non-linearly map the input space into a very high di-mensional feature space,then apply a learning algorithm designed to discover linear patterns in that space.This paper concerns the?rst stage.The basic idea is to train a(generative)hidden Markov model on market data to derive a Fisher kernel for a(discriminative)support vector machine.If each data point is a(possibly varying length)sequence,each may be used to train a probabil-ity model(HMM),with the average of the models in the training set used to construct a global HMM.It is then possible to calculate how much a new data point would‘stretch’the parameters of the global model.

2Literature Review

Jaakkola and Haussler(1999a)introduced the Fisher kernel(named in honour of Sir Ronald Fisher),thus creating a generic mechanism for incorporating gener-ative probability models into discriminative classi?ers such as SVMs.Jaakkola and Haussler(1999b)introduced a generic class of probabilistic regression mod-els and a parameter estimation technique that can make use of arbitrary kernel functions.Jaakkola,Diekhans and Haussler(1999)applied the Fisher kernel method to detecting remote protein homologies which performed well in classi-fying protein domains by SCOP superfamily.Jaakkola,Diekhans and Haussler (2000)found that using the Fisher kernel signi?cantly improved on previous methods for the classi?cation of protein domains based on remote homologies. Moreno and Rifkin(2000)used the Fisher kernel method for large scale Web audio classi?cation.Vinokourov and Girolami(2001)successfully employed the Fisher kernel for document classi?cation.Saunders,Shawe-Taylor and Vinok-ourov(2003)showed how the string kernel can be thought of as a k-stage Markov process,and as a result interpreted as a Fisher kernel.Tsuda,et al.(2004)anal-ysed the statistical properties of the Fisher kernel.Nicotra,Micheli and Starita

1

(2004)extended the Fisher kernel to deal with tree structured data.Kersting and G¨a rtner(2004)extend the Fisher kernel to logical sequences(sequences over an alphabet of logical atoms).Their experiments showed a considerable improvement over results achieved without Fisher kernels for logical sequences. Holub,Welling and Perona(2005)successfully combined generative models with Fisher kernels to realize performance gains on standard object recognition data-sets.Dick and Kersting(2006)developed Fisher kernels for relational data.

3Markov Chains

Markov chains were introduced by the Russian mathematician Andrey Markov

in1906(Markov1906),although the term did not appear for over20years when

it was used by Bernstein(Bernstein1927).A Markov chain is a discrete-state Markov process(see Sewell(2006)).

Formally,a discrete time Markov chain is a sequence of n random variables

X n,n≥0such that for every n P(X n+1=x|X0=x0,X1=x1,...,X n=

x n)=P(X n+1=x|X n=x n).

In words,the future of the system depends on the present,but not the past.

4Hidden Markov Models

A hidden Markov model(HMM)is a temporal probabilistic model in which the state of the process is described by a single discrete random variable.Loosely speaking,it is a Markov chain observed in noise.The theory of hidden Markov models was developed in the late1960s and early1970s by Baum,Eagon,Petrie, Soules and Weiss(Baum and Petrie1966;Baum and Eagon1967;Baum,et al. 1970;Baum1972),whilst the name‘hidden Markov model’was coined by L.P. Neuwirth.For more information on HMMs,see the tutorial papers Rabiner and Juang(1986);Poritz(1988);Rabiner(1989);Eddy(2004)and the books Mac-Donald and Zucchini(1997);Durbin,et al.(1999);Elliot,Aggoun and Moore (2004);Capp′e,Moulines and Ryd′e n(2005).HMMs have earned their popular-

ity largely from successful application to speech recognition(Rabiner1989),but have also been applied to handwriting recognition,gesture recognition,musical score following and bioinformatics.

Formally,a hidden Markov model is a bivariate discrete time process{X k,Y k}k≥0, where X k is a Markov chain and,conditional on X k,Y k is a sequence of indepen-dent random variables such that the conditional distribution of Y k only depends

on X k.

The successful application of HMMs to markets is referenced as far back

as Kemeny,Snell and Knapp(1976)and Juang(1985).The books Bhar and Hamori(2004)and Mamon and Elliott(2007)cover HMMs in?nance.

2

5Fixed Length Strings Generated by a Hidden Markov Model

Parts of the?nal chapter of Shawe-Taylor and Cristianini(2004)—which covers turning generative models into kernels—are followed below.

Let us assume that one has two strings s and t of?xed length n that are composed of symbols from an alphabetΣ.Furthermore it is assumed that they have been generated by a hidden model M,whose elements are represented by strings h of n states each from a set A,and that each symbol is generated independently,so that

P(s,t|h)=

n

i=1

P(s i|h i)P(t i|h i).

Consider the hidden Markov model

P M(h)=P M(h1)P M(h2|h1)...P M(h n|h n?1). De?ne the states of the model to be

{a I}∪A×{1,...,n}∪a F,

with the transition probabilities given by

P M((a,i)|a I)=

P M(a)if i=1; 0otherwise,

P M((a,i)|(b,j))=

P M(a|b)if i=j+1; 0otherwise,

P M(a F|(b,j))=

1if i=n; 0otherwise.

This means that in order to marginalise,one needs to sum over a more com-plex probability distribution for the hidden states to obtain the corresponding marginalisation kernel

κ(s,t)=

h∈A n

P(s|h)P(t|h)P M(h)

=

h∈A n

n

i=1

P(s i|h i)P(t i|h i)P M(h i|h i?1),(1)

where the convention that P M(h1|h0)=P M(h1)has been used.

Each hidden sequence h is considered as a template for the sequences s, t in the sense that if it is in state h i at position i,the probability that the observable sequence has a symbol s i in that position is a function of h i.In

3

the generative model,sequences are generated independently from the hidden template with probabilities P(s i|h i)that can be speci?ed by a matrix of size |Σ|×|A|.So given this matrix and a?xed h,one can compute P(s|h)and P(t|h). The problem is that there are|A|n di?erent possible models for generating the sequences s,t,that is the feature space is spanned by a basis of|A|n dimensions. Furthermore,a special generating process for h of Markov type,the probability of a state depends only on the preceding state,is considered.The consequent marginalisation step will therefore be prohibitively expensive,if performed in a direct way.Dynamic programming techniques will be exploited to speed it up.

Consider the set of states A k a of length k that end with a given by

A k a={h∈A k:h k=a}.

A series of subkernelsκk,a for k=1,...,n and a∈A are introduced as follows

κk,a(s,t)=

h∈A k

a

P(s|h)P(t|h)P M(m)

=

h∈A k

a

k

i=1

P(s i|h i)P(t i|h i)P M(h i|h i?1),

where the de?nitions of P(s|h)and P(h)have been implicitly extended to cover the case when h has fewer than n symbols by ignoring the rest of the string s.

Clearly,the HMM kernel can be expressed simply by

κ(s,t)=

a∈A

κn,a(s,t).

For k=1one has

κ1,a(s,t)=P(s1|a)P(t1|a)P M(a).

Recursive equations for computingκk+1,a(s,t)in terms ofκk,b(s,t)for b∈A are now obtained,as the following derivation shows

κk+1,a(s,t)=

h∈A k+1

a k+1

i=1

P(s i|h i)P(t i|h i)P M(h i|h i?1)

=

b∈A P(s k+1|a)P(t k+1|a)P M(a|b)

h∈A k

b

k

i=1

P(s i|h i)P(t i|h i)P M(h i|h i?1)

=

b∈A

P(s k+1|a)P(t k+1|a)P M(a|b)κk,b(s,t).

When computing these kernels the usual dynamic programming tables,one for eachκk,b(s,t),need to be used,though of course those obtained for k?1can be overwritten when computing k+1.The result is summarised in the following algorithm.

4

Input

Symbol strings s and t ,state transition probability matrix P M (a |b ),initial state probabilities P M (a )and conditional probabilities P (σ|a )of symbols given states.Process

Assume p states,1,...,p .2

for a =1:p 3

DPr(a )=P (S 1|a )P (t 1|a )P M (a );4

end 5

for i =1:n 6

Kern =0;7

for a =1:p 8

DP(a )=0;9

for b =1:p 10

DP(a )=DP(a )+P (s i |a )P (t i |a )P M (a |b )DPr(b );11

end 12

Kern =Kern +DP(a );13

end 14

DPr =DP;15

end Output κ(s,t )=Kern

The complexity of the kernel can be bounded from the structure of the algorithm by O n |A |2 .

6Fisher Kernel

The log-likelihood of a data item x with respect to the model m (θ0)for a given setting of the parameters θ0is de?ned to be

log L θ0(x ).

Consider the vector gradient of the log-likelihood

g (θ,x )= ?log L θ(x )

?θi N i =1.

The Fisher score of a data item x with respect to the model m (θ0)for a given setting of the parameters θ0is

g (θ0,x ).

The Fisher information matrix with respect to the model m (θ0)for a given setting of the parameters θ0is given by

I M =E g (θ0,x )g (θ0,x ) ,

5

where the expectation is over the generation of the data point x according to the data generating distribution.

The Fisher score gives us an embedding into the feature space R N and hence immediately suggests a possible kernel.The matrix I M can be used to de?ne a non-standard inner product in that feature space.

De?nition1The invariant Fisher kernel with respect to the model m(θ0)for a given setting of the parametersθ0is de?ned as

κ(x,z)=g(θ0,x) I?1

M

g(θ0,z).

The practical Fisher kernel is de?ned as

κ(x,z)=g(θ0,x) g(θ0,z).

The Fisher kernel gives a‘natural’similarity measure that takes into ac-count an underlying probability distribution.It seems natural to compare two data points through the directions in which they‘stretch’the parameters of the model,that is by viewing the score function at the two points as a function of the parameters and comparing the two gradients.If the gradient vectors are similar it means that the two data items would adapt the model in the same way,that is from the point of view of the given parametric model at the current parameter setting they are similar in the sense that they would require similar adaptations to the parameters.

7Fisher Kernels for Hidden Markov Models

The model can now be viewed as the sum over all of the state paths or individual models with the parameters the various transition and emission probabilities,so that for a particular parameter setting the probability of a sequence s is given by

P M(s)=

m∈A n P(s|m)P M(m)=

m∈A n

P M(s,m),

where

P M(m)=P M(m1)P M(m2|m1)...P M(m n|m n?1),

and

P(s|m)=

n

i=1

P(s i|m i)

so that

P M(s,m)=

n

i=1

P(s i|m i)P(m i|m i?1).

The parameters of the model are the emission probabilities P(s i|m i)and the transition probabilities P M(m i|m i?1).For convenience parameters are in-troduced

θs

i |m i

=P(s i|m i)andτm

i

|m i?1

=P M(m i|m i?1),

6

where the convention that P M (m 1)=P M (m 1|m 0)with m 0=a 0for a special ?xed state a 0/∈A is used.The di?culty is that these parameters are not independent.The unconstrained parameters are introduced

θσ,a and τa,b

with

θσ|a =θσ,a σ ∈Σθσ ,a and τa |b =τa,b a ∈A τa ,b

These values are assembled into a parameter vector θ.Furthermore it is assumed that the parameter setting at which the derivatives are computed sat-is?es σ∈Σθσ,a = a ∈A

τa,b =1,(2)

for all a,b ∈A in order to simplify the calculations.

The derivatives of the log-likelihood with respect to the parameters θand τmust be computed.The computations for both sets of parameters follow an identical pattern,so to simplify the presentation ?rst a template that assumes both cases is derived.Let

ˉψ(b,a )=ψ(b,a ) b ∈B

ψ(b ,a ),for a ∈A and b ∈B .Let

Q (a ,b )=n

i =1ˉψ

(b i ,a i )c i ,for some constants c i .Consider the derivative of Q (a ,b )with respect to the parameter ψ(b,a )at point (a 0,b 0)where

b ∈B

ψ(b,a 0i )=1for all i .

(3)One has

?Q (a ,b )?ψ(b,a )=n

k =1c k i =k ˉψ(b 0i ,a 0i )c i ??ψ(b,a )ψ(b k ,a k ) b ∈B ψ(b ,a k )=n k =1 [b 0k =b ][a 0k =a ] b ∈B ψ(b ,a 0k )?ψ(b 0k ,a 0k )[a 0k =a ]( b ∈B ψ(b ,a 0k )) c k i =k ˉψ(b 0i ,a 0i )c i =n k =1 [b 0k =b ][a 0k =a ]ˉψ(b,a )?[a 0k =a ] i =k ˉψ(b 0i ,a 0i )c i =n k =1 [b 0k =b ][a 0k =a ]ˉψ(b,a )?[a 0k =a ] Q (a 0,b 0),7

where use of(3)has been made to obtain the third line from the second.Now return to considering the derivatives of the log-likelihood,?rst with respect to the parameterθσ,a

?log P M(s|θ)

?θσ,a =

1

P M(s|θ)

?

?θσ,a

m∈A n

n

i=1

P(s i|m i)P M(m i|m i?1) =

1

P M(s|θ)

m∈A n

?

?θσ,a

n

i=1

θs

i

,m i

σ∈Σ

θσ,m

i

τm

i

|m i?1

.

Letting a be the sequence of states m and b the string s,withψ(a,b)=θb,a

and c i=τm

i |m i?1

one has

Q(a,b)=

n

i=1

θs

i

,m i

σ∈Σ

θσ,m

i

τm

i

|m i?1

=P M(s,m|θ).

It follows from the derivative of Q that

?log P M(s|θ)

?θσ,a =

m∈A n

n

k=1

[s k=σ][m k=a]

θσ|a

?[m k=a]

P M(s,m|θ)

P M(s|θ) =

n

k=1

m∈A n

[s k=σ][m k=a]

θσ|a

?[m k=a]

P M(m|s,θ) =

n

k=1

E

[s k=σ][m k=a]

θσ|a

?[m k=a]

s,θ

=

1

θσ|a

n

k=1

E[[s k=σ][m k=a]|s,θ]?

n

k=1

E[[m k=a]|s,θ],

where the expectations are over the hidden states that generate s.Now consider the derivatives with respect to the parameterτa,b

?log P M(s|θ)

?τa,b =

1

P M(s|θ)

?

?τa,b

m∈A n

n

i=1

P(s i|m i)P M(m i|m i?1) =

1

P M(s|θ)

m∈A n

?

?τa,b

n

i=1

θs

i

,m i

σ∈Σ

θσ,m

i

τm

i

|m i?1

.

Letting a and b be the sequence of states m and b be the same sequence of

states shifted one position,ψ(a,b)=τa,b and c i=θs

i |m i

,one has

Q(a,b)=

n

i=1

θs

i

|m i

τm

i

,m i?1

a ∈A

τa ,m

i?1

τm

i

|m i?1

=P M(s,m|θ).

8

It follows from the derivative of Q that

?log P M(s|θ)

?τa,b =

n

k=1

m∈A n

[m k?1=b][m k=a]

τa|b

?[m k=a]

P M(m|s,θ) =

1

τa|b

n

k=1

E[[m k?1=b][m k=a]|s,θ]?

n

k=1

E[[m k=a]|s,θ],

It remains to compute the expectations in each of the sums.These are the expectations that the particular emissions and transitions occurred in the generation of the string s.

The computation of these quantities will rely on an algorithm known as the forwards-backwards algorithm.As the name suggests this is a two-stage algorithm that computes the quantities

f a(i)=P(s1...s i,m i=a),

in other words the probability that the i th hidden state is a with the pre?x of the string s together with the probability P(s)of the sequence.Following this the backwards algorithm computes

b a(i)=P(s i+1...s n|m i=a).

Once these values have been computed it is possible to evaluate the expectation E[[s k=σ][m k=a]|s]=P(s k=σ,m k=a|s)

=[s k=σ]P(s k+1...s n|m k=a)P(s1...s k,m k=a)

P(s)

=[s k=σ]f a(k)b a(k)

P(s)

.

Similarly

E[[m k=a]|s]=P(m k=a|s)

=P(s k+1...s n|m k=a)P(s1...s k,m k=a)

P(s)

=f a(k)b a(k)

P(s)

.

Finally,for the second pair of expectations the only tricky evaluation is E[[m k?1=b][m k=a]|s],which equals

P(s k+1...s n|m k=a)P(s1...s k?1,m k?1=b)P(a|b)P(s k|m k=a)

P(s)=

f b(k?1)b a(k)τa|bθs

k

|a

P(s)

.

Hence,the Fisher scores can be evaluated based on the results of the forwards-backwards algorithm.The forwards-backwards algorithm again uses a dynamic programming approach based on the recursion

f b(i+1)=θs

i+1|b

a∈A

f a(i)τb|a,

9

with f a

0(0)=1and f a(0)=0,for a=a0.Once the forward recursion is

complete one has

P(s)=

a∈A

f a(n). The initialisation for the backward algorithm is

b a(n)=1 with the recursion

b b(i)=

a∈A τa|bθσ

i+1

|a

b a(i+1).

Putting all of these observations together the following code is obtained,

the calculation of the Fisher scores for the transmission probabilities is my own contribution.

//line numbers refer to Code Fragment12.4(page435)

//in Shawe-Taylor and Cristianini(2004)

//use symbols1,2,3,etc.

#include

#include

#include

#include

#include

using namespace std;

int main()

{

int string_length=10;

int number_of_states=5;

int number_of_symbols=5;

int p=number_of_states;

int n=string_length;

int a,b;

double Prob=0;

string stringstring;

ifstream hmmstream("globalhmm.txt");//INPUT:HMM,contains one line of params ifstream stringfile("strings.txt");//INPUT:symbol strings,one per line ofstream fisherfile("fisher.txt");//OUTPUT:Fisher scores,one data item/line

int s[n+1];//symbol string,uses s[1]to s[n](s[0]is never used)

double PM[p+1][p+1];//state transition probability matrix

double P[number_of_symbols+1][p+1];//conditional probs of symbols given states

double scoree[p+1][number_of_symbols+1];//Fisher scores for the emission probs

10

double scoret[p+1][p+1];//Fisher scores for the transmission probabilities double forw[p+1][n+1];

double back[p+1][n+1];

//initialize to zero

for(int i=0;i<=p;i++)

for(int j=0;j<=p;j++)

PM[i][j]=0;

for(int i=0;i<=number_of_symbols;i++)

for(int j=0;j<=p;j++)

P[i][j]=0;

PM[1][0]=1.0;//because it is a left-to-right hidden Markov model

for(int i=2;i<=p;i++)

PM[i][0]=0;

for(int i=1;i<=p;i++)

for(int j=1;j<=p;j++)

hmmstream>>PM[i][j];

for(int i=1;i<=number_of_symbols;i++)

for(int j=1;j<=p;j++)

hmmstream>>P[i][j];

while(getline(stringfile,stringstring)){

istringstream stringstream(stringstring);

//initialize to zero

for(int i=0;i<=p;i++)

for(int j=0;j<=n;j++)

forw[i][j]=0;

for(int i=0;i<=p;i++)

for(int j=0;j<=n;j++)

back[i][j]=0;

for(int i=0;i<=p;i++)

for(int j=0;j<=number_of_symbols;j++)

scoree[i][j]=0;

for(int i=0;i<=p;i++)

for(int j=0;j<=p;j++)

scoret[i][j]=0;

for(int i=0;i<=n;i++)

s[i]=0;

for(int i=1;i<=n;i++)

stringstream>>s[i];

for(int i=0;i<=p;i++)

for(int j=1;j<=number_of_symbols;j++)

scoree[i][j]=0;//line2

for(int i=0;i<=p;i++)

11

for(int j=1;j<=p;j++)

scoret[i][j]=0;//mvs

for(int i=0;i<=p;i++)

forw[i][0]=0;//line3

for(int i=0;i<=p;i++)//line4

back[i][n]=1;

forw[0][0]=1;//line4(corrected)

Prob=0;

for(int i=1;i<=n;i++){//line5

for(a=1;a<=p;a++){//line7

forw[a][i]=0;//line8

for(b=0;b<=p;b++)//line9(corrected)

forw[a][i]=forw[a][i]+PM[a][b]*forw[b][i-1];//line10

forw[a][i]=forw[a][i]*P[s[i]][a];//line12

}

}

for(a=1;a<=p;a++)//line15

Prob=Prob+forw[a][n];

for(int i=n-1;i>=1;i--){//line18

for(a=1;a<=p;a++){//line19

back[a][i]=0;//line20

for(b=1;b<=p;b++)

back[a][i]=back[a][i]+

PM[b][a]*P[s[i+1]][b]*back[b][i+1];//line22

}

}

//Fisher scores for the emission probabilities

for(int i=n-1;i>=1;i--){//line18

for(a=1;a<=p;a++){//line19

scoree[a][s[i]]=scoree[a][s[i]]+

back[a][i]*forw[a][i]/(P[s[i]][a]*Prob);//line24

for(int sigma=1;sigma<=number_of_symbols;sigma++)

scoree[a][sigma]=scoree[a][sigma]-

back[a][i]*forw[a][i]/Prob;//line26(corrected)

}

}

//Fisher scores for the transmission probabilities

for(int i=n-1;i>=1;i--)

for(b=1;b<=p;b++)

for(a=1;a<=p;a++){

scoret[b][a]=scoret[b][a]+

(back[a][i]*forw[b][i-1]*P[s[i]][a]/Prob-back[b][i]*forw[b][i]/Prob); }

12

//transform Fisher scores to the interval(0,1)using the logistic function //scoree[i][j]=1/(1+exp(-scoree[i][j]));

for(int i=1;i<=p;i++)

for(int j=1;j<=p;j++)

fisherfile<

for(int j=1;j<=number_of_symbols;j++)

for(int i=1;i<=p;i++)

fisherfile<

fisherfile<

}

hmmstream.close();

fisherfile.close();

system("PAUSE");

}

8Test

This section concerns the prediction of synthetic data,generated by a very sim-

ple5-symbol,5-state HMM,in order to test the Fisher kernel.The hidden Markov model used in this thesis is based on a C++implementation of a basic

left-to-right HMM which uses the Baum-Welch(maximum likelihood)training algorithm written by Richard Myers.The hidden Markov model used to gen-

erate the synthetic data is shown below.Following the header are a series of ordered blocks,each of which is two lines long.Each of the5blocks corresponds

to a state in the model.Within each block,the?rst line gives the probability of

the model recurring(the?rst number)followed by the probability of generating

each of the possible output symbols when it recurs(the following?ve numbers).

The second line gives the probability of the model transitioning to the next state

(the?rst number)followed by the probability of generating each of the possible output symbols when it transitions(the following?ve numbers).

states:5

symbols:5

0.50.960.010.010.010.01

0.50.960.010.010.010.01

0.50.010.960.010.010.01

0.50.010.960.010.010.01

0.50.010.010.960.010.01

0.50.010.010.960.010.01

0.50.010.010.010.960.01

0.50.010.010.010.960.01

13

1.00.010.010.010.010.96

0.00.00.00.00.00.0

1.Create a HMM with5states and5symbols,as above.Save as hmm.txt.

https://www.doczj.com/doc/a617274043.html,e the HMM to generate10,000sequences,each11symbols long,{0,1,

2,3},‘generate seq hmm.txt1000011’.Output will be hmm.txt.seq.

3.Save the output,hmm.txt.seq,in Fisher.xls,Sheet1.Split the data into

5000sequences for training,2500sequences for validation and2500se-quences for testing.Separate the11th column,this will be the target and is not used until later.

4.Copy the training data(without the11th column)into strings.txt.

5.Run‘train hmm strings.txt123455.01’.

6.Copy the output,hmmnew.txt,into Fisher.xls,Sheet2.

7.Take the average of each column,and save this as a one-row?le,glob-

alhmm.txt.

8.From Fisher.xls,Sheet1,copy all of the data except the target column

into strings.txt(delete previous contents).

9.Replace symbols thus:4→5,3→4,2→3,1→2,0→1(this is simply

an artefact of the software).Save.

10.Run Fisher.exe,inputs are globalhmm.txt and strings.txt,output will be

?sher.txt.

https://www.doczj.com/doc/a617274043.html,e oldformat.exe to convert?sher.txt to LIBSVM format:‘oldformat

?sher.txt?sher2.txt’.

12.Copy and paste?sher2.txt into Fisher.xls,Sheet3(cells need to be for-

matted for text).

13.Copy target data from Sheet1Fisher.xls into a temporary?le and replace

symbols thus:4→5,3→4,2→3,1→2,0→1.

14.Insert the target data into column A in Fisher.xls,Sheet3,then split the

data into training set,validation set and test set.

15.Copy and paste into training.txt,validation.txt and test.txt.

16.Scale the data.

https://www.doczj.com/doc/a617274043.html,e LIBSVM for regression with default Gaussian(rbf)kernel and use the

validation set to determine C and .‘svmtrain.exe-s3-t2[...]’

14

Support vector regression with a radial basis function kernel(e?γ u? v 2)was used.A validation set was used to select C∈{0.1,1,10,100,1000,10000,100000} and ∈{0.00001,0.0001,0.001,0.01,0.1}.Three parameter combinations were joint best,namely{C100, 0.00001},{C100, 0.0001}and{C100, 0.001}, so the middle one was chosen C=100and =0.0001.

Training set Validation set Test set Correct classi?cation(%)84.0883.5282.80

Table1:Fisher kernel test results

Results are given in Table1(page15).There are?ve symbols,so if the algorithm was no better than random,one would expect a correct classi?cation rate of20.00%.The results are impressive,and evidence the fact that my implementation of the Fisher kernel works.

15

References

BAUM,Leonard E.,1972.An inequality and associated maximization technique in statistical estimation for probabilistic functions of Markov processes.In: Oved SHISHA,ed.Inequalities III:Proceedings of the Third Symposium on Inequalities.New York:Academic Press,pp.1–8.

BAUM,L.E.,and J.A.EAGON,1967.An Inequality with Applications to Statistical Estimation for Probabilistic Functions of a Markov Process and to a Model for Ecology.Bulletin of the American Mathematical Society,73(3), 360—363.

BAUM,Leonard E.,and Ted PETRIE,1966.Statistical Inference for Proba-bilistic Functions of Finite State Markov Chains.The Annals of Mathematical Statistics,37(6),1554–1563.

BAUM,Leonard E.,et al.,1970.A Maximization Technique Occurring in the Statistical Analysis of Probabilistic Functions of Markov Chains.The Annals of Mathematical Statistics,41(1),164–171.

BERNSTEIN,Serge,1927.Sur l’Extension du Th′e or`e me Limite du Calcul des Probabilit′e s aux Sommes de Quantit′e s D′e pendantes.Mathematische An-nalen,97(1),1–59.

BHAR,Ramaprasad,and Shigeyuki HAMORI,2004.Hidden Markov Models: Applications to Financial Economics.Volume40of Advanced Studies in The-oretical and Applied Econometrics.Dordrecht:Kluwer Academic Publishers.

CAPP′E,Olivier,Eric MOULINES,and Tobias RYD′EN,2005.Inference in Hidden Markov Models.Springer Series in Statistics.New York:Springer Science+Business Media.

DICK,Uwe,and Kristian KERSTING,2006.Fisher Kernels for Rela-tional Data.In:Johannes F¨URNKRANZ,Tobias SCHEFFER,and Myra SPILIOPOULOU,eds.Machine Learning:ECML2006:17th European Con-ference on Machine Learning,Berlin,Germany,September2006,Proceedings, Volume4212of Lecture Notes in Computer Science.Berlin:Springer-Verlag, pp.114–125.

DURBIN,R.,et al.,1999.Biological Sequence Analysis:Probabilistic Models of Proteins and Nucleic Acids.Cambridge:Cambridge University Press. EDDY,Sean R.,2004.What is a Hidden Markov Model?Nature Biotechnology, 22(10),1315–1316.

ELLIOT,Robert J.,Lakhdar AGGOUN,and John B.MOORE,2004.Hid-den Markov Models:Estimation and Control.Volume29of Applications of Mathematics.New York:Springer-Verlag.

16

HOLUB,Alex D.,Max WELLING,and Pietro PERONA,https://www.doczj.com/doc/a617274043.html,bining Generative Models and Fisher Kernels for Object Recognition.In:Pro-ceedings of the Tenth IEEE International Conference on Computer Vision (ICCV’05),Volume1.Washington,DC:IEEE,pp.136–143. JAAKKOLA,Tommi,Mark DIEKHANS,and David HAUSSLER,https://www.doczj.com/doc/a617274043.html,ing the Fisher Kernel Method to Detect Remote Protein Homologies.In:Thomas LENGAUER,et al.,eds.Proceedings of the Seventh International Conference on Intelligent Systems for Molecular Biology.Menlo Park,CA:AAAI Press, pp.149–158.

JAAKKOLA,Tommi,Mark DIEKHANS,and David HAUSSLER,2000.A Discriminative Framework for Detecting Remote Protein Homologies.Journal of Computational Biology,7(1–2),95–114.

JAAKKOLA,Tommi S.,and David HAUSSLER,1999a.Exploiting Genera-tive Models in Discriminative Classi?ers.In:Michael S.KEARNS,Sara A. SOLLA,and David A.COHN,eds.Advances in Neural Information Process-ing Systems11,Bradford Books.Cambridge,MA:The MIT Press,pp.487–493.

JAAKKOLA,Tommi S.,and David HAUSSLER,1999b.Probabilistic Kernel Regression Models.In:David HECKERMAN and Joe WHITTAKER,eds. Proceedings of the1999Conference on AI and Statistics.San Mateo,CA: Morgan Kaufmann.

JUANG,B.H.,1985.Maximum-likelihood estimation for mixture multivariate stochastic observations of Markov chains.AT&T Technical Journal,64(6), 1235–1249.

KEMENY,John G.,https://www.doczj.com/doc/a617274043.html,urie SNELL,and Anthony W.KNAPP,1976.Denu-merable Markov Chains.Second ed.Volume40of Graduate Texts in Mathe-matics.New York:Springer-Verlag.

KERSTING,Kristian,and Thomas G¨ARTNER,2004.Fisher Kernels for Log-ical Sequences.In:Jean-Fran?c ois BOULICAUT,et al.,eds.Machine Learn-ing:ECML2004:15th European Conference on Machine Learning,Pisa, Italy,September2004.Proceedings,Volume3201of Lecture Notes in Com-puter Science.Berlin:Springer,pp.205–216.

MACDONALD,Iain L.,and Walter ZUCCHINI,1997.Hidden Markov and Other Models for Discrete-Valued Time Series.Volume70of Monographs on Statistics and Applied Probability.Boca Raton:Chapman&Hall/CRC. MAMON,Rogemar S.,and Robert J.ELLIOTT,eds.,2007.Hidden Markov Models in Finance.Volume104of International Series in Operations Research &Management Science.New York:Springer.

17

MARKOV,A.A.,1906.Rasprostranenie zakona bol’shih chisel na velichiny, zavisyaschie drug ot druga.Izvestiya Fiziko-Matematicheskogo Obschestva pri Kazanskom Universitete,2-ya seriya,15,135–156.In Russian.English translation:‘Extension of the law of large numbers to dependent quantities’. MORENO,Pedro J.,and Ryan RIFKIN,https://www.doczj.com/doc/a617274043.html,ing the Fisher Kernel Method for Web Audio Classi?cation.In:2000IEEE International Conference on Acoustics,Speech,and Signal Processing:Proceedings,Volume IV.IEEE, pp.2417–2420.

NICOTRA,Luca,Alessio MICHELI,and Antonina STARITA,2004.Fisher Kernel for Tree Structured Data.In:Jose C.PRINCIPE,et al.,eds.Proceed-ings.2004IEEE International Joint Conference on Neural Networks.Volume 3.IEEE,pp.1917–1922.

PORITZ,Alan B.,1988.Hidden Markov Models:A Guided Tour.In:1988 International Conference on Acoustics,Speech,and Signal Processing,1988. ICASSP-88.Volume1.New York:IEEE Press,pp.7–13.

RABINER,Lawrence R.,1989.A Tutorial on Hidden Markov Models and Selected Applications in Speech Recognition.Proceedings of the IEEE,77(2), 257–286.

RABINER,L.R.,and B.H.JUANG,1986.An Introduction to Hidden Markov Models.IEEE ASSP Magazine,3(1,Part1),4–16.

SAUNDERS,Craig,John SHAWE-TAYLOR,and Alexei VINOKOUROV, 2003.String Kernels,Fisher Kernels and Finite State Automata.In:Suzanna BECKER,Sebastian THRUN,and Klaus OBERMAYER,eds.Advances in Neural Information Processing Systems15,Bradford Books.Cambridge,MA: The MIT Press,pp.633–640.

SEWELL,Martin,2006.Stochastic Processes.Lecture given to Department of Economics,Royal Holloway,University of London,Egham.

SHAWE-TAYLOR,John,and Nello CRISTIANINI,2004.Kernel Methods for Pattern Analysis.Cambridge:Cambridge University Press.

TSUDA,Koji,et al.,2004.Asymptotic Properties of the Fisher Kernel.Neural Computation,16(1),115–137.

VINOKOUROV,Alexei,and Mark GIROLAMI,2001.Document Classi?cation Employing the Fisher Kernel Derived from Probabilistic Hierarchic Corpus Representations.In:Proceedings of ECIR-01,23rd European Colloquium on Information Retrieval Research.British Computer Society Information Retrieval Specialist Group.Berlin:Springer-Verlag,pp.24–40.

18

Fisher判别分析原理详解

Fisher判别分析原理详解 说起Fisher判别分析,不得不提到一个大神级人物! Ronald Aylmer Fisher (1890~1962) 英国统计学家和遗传学家 主要著作有:《根据孟德尔遗传方式的亲属间的相关》、《研究者用的统计方法》、《自然选择的遗传理论》、《试验设计》、《近交的理论》及《统计方法和科学推理》等。他一生在统计生物学中的功绩是十分突出的。 ?生平 1890年2月17日生于伦敦,1962年7月29日卒于澳大利亚阿德莱德。 1912年毕业于剑桥大学数学系,后随英国数理统计学家J.琼斯进修了一年统计力学。他担任过中学数学教师,1918年任罗坦斯泰德农业试验站统计试验室主任。 1933年,因为在生物统计和遗传学研究方面成绩卓著而被聘为伦敦大学优生学教授。 1943年任剑桥大学遗传学教授。

1957年退休。 1959年去澳大利亚,在联邦科学和工业研究组织的数学统计部作研究工作。 大神解决的问题 ?Fisher 线性判别函数的提出: 在用统计方法进行模式识别时,许多问题涉及到维数,在低维空间可行的方法,在高维空间变得不可行。因此,降低维数就成为解决实际问题的关键。Fisher 的方法,就是解决维数压缩问题。 对xn的分量做线性组合可得标量 yn=wTxn,n=1,2,…,Ni 得到N个一维样本yn组成的集合。从而将多维转换到了一维。 考虑把d维空间中的数据点投影到一条直线上去的问题,需要解决的两个问题: (1)怎样找到最好的投影直线方向;(2)怎样向这个方向实现投影,这个投影变 换就是要寻求的解向量w*。这两个问题就是Fisher方法要解决的基本问题。?判别分析的一些基本公式 Fisher判别分析用于两类或两类以上间的判别,但常用于两类间判别。 Fisher判别函数表达式(多元线性函数式): 判别函数的系数是按照组内差异最小和组间差异最大同时兼顾的原则来确定判别函数的。 Fisher判别准则: 判别临界点: Fisher判别分析思想: 1. 类间差异大,类内变异小, 最大 2. 方差分析的思想:以下值最大 ?Fisher判别的原理 分析w1方向之所以比w2方向优越,可以归纳出这样一个准则,即向量w的方向选择应能使两类样本投影的均值之差尽可能大些,而使类内样本的离散程度尽可能小。这就是Fisher准则函数的基本思路。如下图:

Fisher判别分析

对案例中小企业的破产模型做Fisher判别分析 江义114113001059 一问题:对企业的运行状态利用Fisher判别进行分类 选取四个经济指标用于判断企业处于破产状态还是正常运行状态,具体数据如下,其中类别1表示破产状态,类别2表示正常运行状态 X1总负债率X2收益率指 标 X3短期 支付能 力 X4生产 效率指 标 类别 -0.45 -0.41 1.09 0.45 1 -0.56 -0.31 1.51 0.16 1 0.06 0.02 1.01 0.4 1 -0.07 -0.09 1.45 0.26 1 0.38 0.11 3.27 0.55 2 0.19 0.05 2.25 0.33 2 0.32 0.07 4.24 0.63 2 0.04 0.01 1.5 0.71 2 -0.06 -0.06 1.37 0.4 1 0.07 -0.01 1.37 0.34 2 -0.13 -0.14 1.42 0.44 1 0.15 0.06 2.23 0.56 2 0.16 0.05 2.31 0.2 2 0.29 0.06 1.84 0.38 带测定 0.54 0.11 2.33 0.48 带测定 二、程序如下:(R语言) > data=read.table("E:/bac/qiye.txt",header=T) > data1=c(rep(1,6),rep(2,7)) > data2=as.factor(data1) > data$class=data2 > attach(data) > names(data) [1] "X1" "X2" "X3" "X4" "class" > library(MASS) > data.lda=lda(class~X1+X2+X3+X4) > data.lda Call: lda(class ~ X1 + X2 + X3 + X4) Prior probabilities of groups: 1 2 0.4615385 0.5384615 Group means:

Fisher判别函数

Fisher 判别函数的使用具体步骤 Fisher 多类判别模型 假定事物由p 个变量描述, 即: x=(p x x x ,...,,21)T 该种事物有G 个类型, 从每个类型中顺次抽取p n n n ,...,,21个样品, 共计n= ∑=G i i 1 n 个样品。 即从第g 类取了g n 个样品, g=1,2,?, G, 第g 类的第i 个样品, 用向量: gi x =(pgi gi gi x x ,...,,x 21)T (1) ( 1) 式中, 第一个下标是变量号, 第二个下标是类型号,第三个下标是样品号。设判别函数为: T x p p v x v x v x v =+++=...y 2211 (2) 其中: V=(p v v v ,...,21)T 按照组内差异最小, 组间差异最大同时兼顾的原则, 来确定判别函数系数。(中间推导过程不在这里介绍了) 最终就有个判别函数:,y x V T j j =1,...,2,1s j = 一般只取前M=min(G- 1,p)个, 即: M j x v x v x v y p pj j j j ,...,2,1,...2211=+++= (3) 根据上述M 个判别函数, 可对每一个待判样品做出判别。 ),...,,(x 020100p x x x= 其过程如下: 1、把x0 代入式(3) 中每一个判别函数, 得到M 个数 ,,...,2,1,...y 202101j 0M j x v x v x v p pj j j =+++= 记:T M y y y y ),...,,(020100= 2、把每一类的均值代入式(3)得 G g y y y y G g M j x v x v x v y M g g g g pg pg g g g g j g ,...,2,1),,...,,(,...2,1,,...,2,1,...212211====+++= 3、计算:∑=-=M j j j g g y y D 1 2 02 )(,从这G 个值中选出最小值:)(min 212g G g h D D ≤≤=。这样就把0 x 判为h 类。

费希尔判别法理论

费希尔判别 费希尔判别(或称典型判别)的基本思想是投影(或降维):用p维向量 x (X i,X2, X p)的少数几个线性组合(称为费希尔判别函数或典型变量) y i a i x, y2 a?x, y x (—般r明显小于p )来代替原始的p个变量 X i,X2, X p,以达到降维的目的,并根据这r个判别函数y i,y2, *对样品的归属做出判别或将各组分离。成功的降维将使样品的归类或组的分离更为方便和有效,并且可以对前三个判别函数作图,从直观的几何图像上区别各组。 在降维的过程中难免会有部分有用信息的损失,但只要使用的方法得当,我们可以最大限度地减少这种损失,从而保留尽可能多的有用信息,即关于能够反 点画于直角坐标系上,一组的样品点用“肿表示,另一组的样品点用“c”表示。 假定我们希望将二维空间的点投影到某个一维空间,即一条直线上,然后再对两组进行判别,则投影到不同的直线上,判别的效果一般是不同的。从图中可见,

如果两组的点都投影到直线 z 上则这两组的投影点在该直线上的分布几乎无任 何差异,他们完全混合在一起,我们无法将这两组的点区别开来, 这样的降维把 反应两组间差异的信息都给损失了, 显然是不可取的。事实上,最好的投影是投 影到直线y 上,因为它把两组的投影点很清楚地区分了开来, 这种降维把有关两 组差异的信息很好地保留了下来,几乎没有任何损失,如此就完全可以在一维的 直线上作判别分析。 我们现考虑在R p 中将k 组的p 维数据向量投影到某个具有最佳方向的 a 上, 即投影到a 上的点能最大限度地显现出各组之间的差异。 设来自组i 的p 维观测值为X j ,j=1,2, ,n i ,i=l,2, ,k ,将它们共同投影 到某一 p 维常数向量a 上,得到的投影点可分别对应线性组合 y j =a x 0, j=1,2, ,n i ,i=1,2, ,k 。这样,所有的p 维观测值就简化为一维观测值。下面 我们用%表示组i 中y j 的均值,y 表示所有组k 组的y 0的总均值,即 对于任一用来投影的a ,我们需要给出一个能反映组之间分离程度的度量 比较图 中的上、下半图,上半图三组均值之间的差异程度与下半图是相同的, 而前者组之间的分离程度却明显高于后者, 原因就在于前者的组内变差要远小于 后者,后者组之间有较多重叠。因此,可以考虑将组之间的分离程度度量为相对 其组内变差的组间变差。在以下的讨论中,我们需假定各组的协方差矩阵相同,n i j i y j a X i 式中n X i 1 ni x ij , n j 1 a X i 1 k - n i X i o n i 1 n i n

fisher判别式

Fisher 线性判别式 前面讲过的感知器准则、最小平方和准则属于用神经网络的方法解决分类问题。下面介绍一种新的判决函数分类方法。 由于线性判别函数易于分析,关于这方面的研究工作特别多。历史上,这一工作是从R.A.Fisher 的经典论文(1936年)开始的。我们知道,在用统计方法进行模式识别时,许多问题涉及到维数,在低维空间行得通的方法,在高维空间往往行不通。因此,降低维数就成为解决实际问题的关键。Fisher 的方法,实际上涉及维数压缩。 如果要把模式样本在高(d )维的特征向量空间里投影到一条直线上,实际上就是把特征空间压缩到一维,这在数学上容易办到。另外,即使样本在高维空间里聚集成容易分开的群类,把它们投影到一条任意的直线上,也可能把不同的样本混杂在一起而变得无法区分。也就是说,直线的方向选择很重要。 在一般情况下,总可以找到某个最好的方向,使样本投影到这个方向的直线上是最容易分得开的。如何找到最好的直线方向,如何实现向最好方向投影的变换,是Fisher 法要解决的基本问题。这个投影变换就是我们寻求的解向量* w 。 1.线性投影与Fisher 准则函数 在21/w w 两类问题中,假定有n 个训练样本),....,2,1(n k x k =其中1n 个样本来自i w 类型,2n 个样本来自j w 类型,21n n n +=。两个类型的训练样本分别构成训练样本的子集1X 和2X 。 令:k T k x w y =,n k ,...,2,1= (4.5-1) k y 是向量k x 通过变换w 得到的标量,它是一维的。实际上,对于给定的w ,k y 就是判决函数的值。 由子集1X 和2X 的样本映射后的两个子集为1Y 和2Y 。因为我们关心的是w 的方向,可以令1||||=w ,那么k y 就是k x 在w 方向上的投影。使1Y 和2Y 最容易区分开的w 方向正是区分超平面的法线方向。如下图: 图中画出了直线的两种选择,图(a)中,1Y 和2Y 还无法分开,而图(b)的选择可以使1Y 和2Y 区分开来。所以图(b)的方向是一个好的选择。 下面讨论怎样得到最佳w 方向的解析式。 各类在d 维特征空间里的样本均值向量: ∑∈= i k X x k i i x n M 1,2,1=i (4.5-2) 通过变换w 映射到一维特征空间后,各类的平均值为: ∑∈= i k Y y k i i y n m 1,2,1=i (4.5-3) 映射后,各类样本“类内离散度”定义为: 2 2 () k i i k i y Y S y m ∈= -∑ ,2,1=i (4.5-4) 显然,我们希望在映射之后,两类的平均值之间的距离越大越好,而各类的样本类内离散度越小越好。因此,定义Fisher

Fisher线性判别分析实验(模式识别与人工智能原理实验1)

实验1 Fisher 线性判别分析实验 一、摘要 Fisher 线性判别分析的基本思想:通过寻找一个投影方向(线性变换,线性组合),将高维问题降低到一维问题来解决,并且要求变换后的一维数据具有如下性质:同类样本尽可能聚集在一起,不同类的样本尽可能地远。 Fisher 线性判别分析,就是通过给定的训练数据,确定投影方向W 和阈值y0,即确定线性判别函数,然后根据这个线性判别函数,对测试数据进行测试,得到测试数据的类别。 二、算法的基本原理及流程图 1 基本原理 (1)W 的确定 各类样本均值向量mi 样本类内离散度矩阵i S 和总类内离散度矩阵w S 12w S S S =+ 样本类间离散度矩阵b S 在投影后的一维空间中,各类样本均值T i i m '= W m 。样本类内离散度和总类内离散度 T T i i w w S ' = W S W S ' = W S W 。样本类间离散度T b b S ' = W S W 。 Fisher 准则函数满足两个性质: ·投影后,各类样本内部尽可能密集,即总类内离散度越小越好。 ·投影后,各类样本尽可能离得远,即样本类间离散度越大越好。 根据这个性质确定准则函数,根据使准则函数取得最大值,可求出W : -1w 12W = S (m - m ) 。 (2)阈值的确定 实验中采取的方法:012y = (m ' + m ') / 2。 (3)Fisher 线性判别的决策规则 对于某一个未知类别的样本向量x ,如果y=W T ·x>y0,则x ∈w1;否则x ∈w2。 x 1 m x, 1,2 i i X i i N ∈= =∑T x S (x m )(x m ), 1,2 i i i i X i ∈= --=∑T 1212S (m m )(m m )b =--

判别分析中Fisher判别法的应用

1 绪论 1.1课题背景 随着社会经济不断发展,科学技术的不断进步,人们已经进入了信息时代,要在大量的信息中获得有科学价值的结果,从而统计方法越来越成为人们必不可少的工具和手段。多元统计分析是近年来发展迅速的统计分析方法之一,应用于自然科学和社会各个领域,成为探索多元世界强有力的工具。 判别分析是统计分析中的典型代表,判别分析的主要目的是识别一个个体所属类别的情况下有着广泛的应用。潜在的应用包括预测一个公司是否成功;决定一个学生是否录取;在医疗诊断中,根据病人的多种检查指标判断此病人是否有某种疾病等等。它是在已知观测对象的分类结果和若干表明观测对象特征的变量值的情况下,建立一定的判别准则,使得利用判别准则对新的观测对象的类别进行判断时,出错的概率很小。而Fisher判别方法是多元统计分析中判别分析方法的常用方法之一,能在各领域得到应用。通常用来判别某观测量是属于哪种类型。在方法的具体实现上,采用国广泛使用的统计软件SPSS (Statistical Product and Service Solutions),它也是美国SPSS公司在20世纪80年代初开发的国际上最流行的视窗统计软件包之一 1.2 Fisher判别法的概述 根据判别标准不同,可以分为距离判别、Fisher判别、Bayes判别法等。Fisher 判别法是判别分析中的一种,其思想是投影,Fisher判别的基本思路就是投影,针对P维空间中的某点x=(x1,x2,x3,…,xp)寻找一个能使它降为一维数值的线性函数y(x):()j j x C y = x∑

然后应用这个线性函数把P 维空间中的已知类别总体以及求知类别归属的样本都变换为一维数据,再根据其间的亲疏程度把未知归属的样本点判定其归属。这个线性函数应该能够在把P 维空间中的所有点转化为一维数值之后,既能最大限度地缩小同类中各个样本点之间的差异,又能最大限度地扩大不同类别中各个样本点之间的差异,这样才可能获得较高的判别效率。在这里借用了一元方差分析的思想,即依据组间均方差与组均方差之比最大的原则来进行判别。 1.3 算法优缺点分析 优点:(1)一般对于线性可分的样本,总能找到一个投影方向,使得降维后样本仍然线性可分,而且可分性更好即不同类别的样本之间的距离尽可能远,同一类别的样本尽可能集中分布。 (2)Fisher 方法可直接求解权向量*w ; (3)Fisher 的线性判别式不仅适用于确定性模式分类器的训练,而且对于随机模式也是适用的,Fisher 还可以进一步推广到多类问题中去 缺点: (1)如果21M M =,0*=w ,则样本线性不可分; 21M M ≠,未必线性可分; w S 不可逆,未必不可分。 (2)对线性不可分的情况,Fisher 方法无法确定分类 2 实验原理 2.1 线性投影与Fisher 准则函数 各类在d 维特征空间里的样本均值向量:

改进的Fisher判别法

文章编号:1000-2243(2006)04-0473-05 改进的Fisher判别方法 黄利文1,2,梁飞豹1 (1.福州大学数学与计算机科学学院,福建 福州 350002;2.泉州师范学院理工学院,福建 泉州 362000)摘要:对Fisher判别方法进行了改进,其主要思想是改变Fisher判别中以临界值为准则的判别方法,而以各总体的投影值所确定的正态分布的密度函数作为样品归类准则,并形成多次判别.例子表明,该方法优于Fisher判别方法. 关键词:Fisher判别;临界值;判别分析 中图分类号:O212 文献标识码:A Improvement Fisher discriminant analysis method HUANG Li - wen1,2, LIANG Fei - bao1 (1. College of Mathematics and Computer Science, Fuzhou University, Fuzhou, Fujian 350002, China; 2. School of Science, Quanzhou Normal University, Quanzhou, Fujian 362000, China) Abstract: Has improved the Fisher discriminant method, its main thought is to change the method of Fisher discriminant taking critical value as criterion, but the normal distribution function which deter- mined by various ensembles projection value took the sample classification criterion, and forms the multi- variate discriminate method. The example indicates this method is superior to Fisher discriminant. Keywords : Fisher discriminant; critical value; discriminant analysis

第4章 判别分析实验讲义

实验项目四判别分析的计算机实现 一、实验内容、目标及要求 (一)实验内容 选取140家上市公司作为样本,其中70家为由于“财务状况异常”而被交易所对其股票实行特别处理(Special Treatment,简称ST)的公司,另外70家为财务正常的公司。为了研究上市公司发生财务困境的可能性,以“是否被ST”为分组变量,选择资产负债率、总资产周转率和总资产利润率几个财务指标作为判别分析变量,这三个指标分别从上市公司的偿债能力、资产管理能力和获利能力三个不同的角度反映了企业的财务状况。(数据略) (二)实验目标 贝叶斯判别、费希尔判别法的计算机操作及结果分析。 (三)实验要求 要求学生能熟练应用计算机软件进行判别分析并对结果进行分析,培养实际应用能力。 二、实验准备 (一)运行环境说明 电脑操作系统为Windows XP及以上版本,所需软件为SPSS 16.0。 (二)基础数据设置说明 将数据正确导入SPSS,设置相应的变量值。 三、实验基本操作流程及说明 (一)系统界面及说明 同实验一。

(二)操作步骤 1. 选择菜单项Analyze→Classify→Discriminate,打开Discriminate Analysis对话框,如图4-1。将分组变量st移入Grouping V ariable列表框中,将自变量x1-x3选入Independents 列表框中。 选择Enter independents together单选按钮,即使用所有自变量进行判别分析。若选择了Use stepwise method单选按钮,则可以根据不同自变量对判别贡献的大小进行变量筛选,此时,对话框下方的Method按钮被激活,可以通过点击该按钮设置变量筛选的方法及变量筛选的标准。 图4-1 Discriminate Analysis对话框 2. 单击Define Range按钮,在打开的Define Range子对话框中定义分组变量的取值范围。本例中分类变量的取值范围为0到1,所以在Minimum和Maximum输入框中分别输入0和1。单击Continue按钮,返回主对话框。 3. 如果不想使用全部的样本进行分析,单击Select按钮,则Discriminate Analysis对话框下方会跳出一个Selection Variable列表框,将一个选择变量移入Selection Variable列表框,并单击Rule按钮,设置选择条件。这样,只有满足选择条件的观测才能参与判别分析。 4. 单击Statistics按钮,在跳出的Statistics子对话框中指定输出的描述统计量和判别函数系数。该对话框中各选项的含义如下: Descriptives选项栏:输出原始数据的描述性统计量 ◆Means:输出各类中所有自变量的均值、组内标准差以及总样本的均值和标准差; ◆Univariate ANOV A:进行单因素方差分析,检验的原假设为不同类别中自变量的均 值不存在显著差异; ◆Box’s M:对各类的协方差矩阵是否相等进行检验。 Matrices选项栏:输出各种不同的协差阵和相关系数矩阵 ◆Within-groups correlation matrix:平均组内相关系数矩阵,它是由平均组内协差阵 计算得到的; ◆Within-groups covariance matrix:平均组内协差阵,它是由各组的协差阵平均后得 到的; ◆Separate-groups covariance matrix:分别输出各个类的协差阵; ◆Total covariance matrix:总体协差阵。 Function Coefficients选项栏:输出不同的判别函数系数 ◆Fisher’s:给出Bayes线性判别函数的系数。(注意:这个选项不是要给出Fisher判 别函数的系数。这个复选框的名字之所以为Fisher’s,是因为按判别函数值最大进

贝叶斯判别、费希尔判别法的计算机操作及结果分析

贝叶斯判别、费希尔判别法的计算机 操作及结果分析 一、实验内容、目标及要求 (一)实验内容 选取140家上市公司作为样本,其中70家为由于“财务状况异常”而被交易所对其股票实行特别处理(Special Treatment,简称ST)的公司,另外70家为财务正常的公司。为了研究上市公司发生财务困境的可能性,以“是否被ST”为分组变量,选择资产负债率、总资产周转率和总资产利润率几个财务指标作为判别分析变量,这三个指标分别从上市公司的偿债能力、资产管理能力和获利能力三个不同的角度反映了企业的财务状况。(二)实验目标 贝叶斯判别、费希尔判别法的计算机操作及结果分析。 (三)实验要求 要求学生能熟练应用计算机软件进行判别分析并对结果进行分析,培养实际应用能力。 二、实验准备 (一)运行环境说明 电脑操作系统为Windows XP及以上版本,所需软件为SPSS 16.0。

(二)基础数据设置说明 将数据正确导入SPSS,设置相应的变量值。 三、实验基本操作流程及说明 (一)系统界面及说明 同实验一。 (二)操作步骤 1. 选择菜单项Analyze→Classify→Discriminate,打开Discriminate Analysis对话框,如图4-1。将分组变量st移入Grouping Variable列表框中,将自变量x1-x3选入Independents列表框中。 选择Enter independents together单选按钮,即使用所有自变量进行判别分析。若选择了Use stepwise method单选按钮,则可以根据不同自变量对判别贡献的大小进行变量筛选,此时,对话框下方的Method按钮被激活,可以通过点击该按钮设置变量筛选的方法及变量筛选的标准。 图4-1 Discriminate Analysis对话框

fisher判别

fisher判别

实验名称:fisher判别一、实验目的和要求 通过上机操作,完成spss软件的fisher判别二、实验内容和步骤 依次点击,选择discriminant 如下图所示进行操作

点击ststistics,进行以下操作

点击classification,进行以下操作 点击save,进行以下操作

Analysis Case Processing Summary Unweighted Cases N Percent Valid 15 100.0 Excluded Missing or out-of-range group codes 0 .0 At least one missing discriminating variable 0 .0 Both missing or out-of-range group codes and at least one missing discriminating variable 0 .0 Total 0 .0 Total 15 100.0 该表为分析案例处理摘要表,反映的是有效样本与缺失值的情况,可以看出本案例中有效值有15个,缺失值为15个 Group Statistics 类别Mean Std. Deviation Valid N (listwise) Unweighted Weighted 1.00 X1 188.6000 57.13843 5 5.000 X2 150.4000 16.50152 5 5.000 X3 13.8000 5.93296 5 5.000 X4 20.0000 13.32291 5 5.000 2.00 X1 157.0000 41.17038 5 5.000 X2 115.0000 14.81553 5 5.000

FISHER线性判别MATLAB实现

Fisher 线性判别上机实验报告 班级: 学号: 姓名: 一.算法描述 Fisher 线性判别分析的基本思想:选择一个投影方向(线性变换,线性组合),将高维问题降低到一维问题来解决,同时变换后的一维数据满足每一类内部的样本尽可能聚集在一起,不同类的样本相隔尽可能地远。 Fisher 线性判别分析,就就是通过给定的训练数据,确定投影方向W 与阈值w0, 即确定线性判别函数,然后根据这个线性判别函数,对测试数据进行测试,得到测试数据的类别。 线性判别函数的一般形式可表示成0)(w X W X g T += 其中 ????? ??=d x x X Λ1 ?????? ? ??=d w w w W Λ21 Fisher 选择投影方向W 的原则,即使原样本向量在该方向上的投影能兼顾类间分布尽可能分开,类内样本投影尽可能密集的要求。 如下为具体步骤: (1)W 的确定

样本类间离散度矩阵b S 在投影后的一维空间中,各类样本均值T i i m '= W m 样本类内离散度与总类内离散度 T T i i w w S ' = W S W S ' = W S W 样本类间离散度T b b S ' = W S W Fisher 准则函数为 max 22 212 21 ~~)~~()(S S m m W J F +-= (2)阈值的确定 w 0 就是个常数,称为阈值权,对于两类问题的线性分类器可以采用下属决策规 则: 令) ()()(2 1 x x x g g g -=则: 如果g(x)>0,则决策w x 1∈;如果g(x)<0,则决策w x 2∈;如果g(x)=0,则可将x 任意分到某一类,或拒绝。 (3)Fisher 线性判别的决策规则 Fisher 准则函数满足两个性质: 1、投影后,各类样本内部尽可能密集,即总类内离散度越小越好。 2、投影后,各类样本尽可能离得远,即样本类间离散度越大越好。 根据这个性质确定准则函数,根据使准则函数取得最大值,可求出 W :-1 w 12W = S (m - m ) 。 这就就是Fisher 判别准则下的最优投影方向。 最后得到决策规则 T 1212S (m m )(m m ) b =--

条件概率、全概率公式与贝叶斯公式

条件概率、全概率公式与贝叶斯公式 一、背景 一个随机事件的概率,确切地说,是指在某些给定的条件下,事件 发生的可能性大小的度量.但如果给定的条件发生变化之后,该事件的概率一般也随之变化.于是,人们自然提出:如果增加某个条件之后,事件的概率会怎样变化的?它与原来的概率之间有什么关系?显然这类现象是常有的. [例1] 设有一群共人,其中个女性,个是色盲患者. 个色盲患者中女性占个. 如果={从中任选一个是色盲}, ={从中任选一个是女性},此时, .如果对选取规则附加条件:只在女性中任选一位,换一句话说,发生之后,发生的概率(暂且记为) 自然是. [例2] 将一枚硬币抛掷,观察其出现正反面的情况.设事件为“两次掷出同一面”,事件为“至少有一次为正面H”.现在来求已知事件已经发生的条件下事件发生的概率. 这里,样本空间.易知此属于古典概型问题.已知事件已发生,有了这一信息,知道不可能发生,即知试验所有可能结果所成的集合就是.中共有3个元素,其中只有属于.于是,在发生的条件下,发生的概率为

对于例1,已知 容易验证在发生的条件下,发生的概率 对于例2,已知 容易验证发生的条件下,发生的概率 对一般古典概型, 容易验证:只要,则在发生的条件下, 发生的概率, 总是成立的. 在几何概率场合,如果向平面上单位正方形内等可能任投一点,则当发生的条件下, 这时发生的概率为

由此可知对上述的两个等可能性的概率模型,总有成立. 其实,还可以验证, 这个关系式对频率也是成立的.于是,从这些共性中得到启发,引入下面的一般定义. 二、条件概率 若是一个概率空间,,若,则对于任意的,称 为已知事件发生的条件下, 事件发生的条件概率. [例3] 一盒子中装有4只产品,其中有3只是一等品,1只是二等品.从中取产品两次,每次任取一只,作不放回抽样,设事件为“第二次取到的是一等品”,事件为“第一次取到的是一等品”,试求条件概率 解:易知此属古典概型问题.将产品编号:1,2,3号为一等品,4号为二等品.以表示第一次、第二次分别取到第号、第号产品.试验E (取产品两次,记录其号码)的样本空间为 ={(1,2),(1,3),(1,4), (2,1),(2,3),(2,4), (3,1),(3,2),(3,4), (4,1),(4,2),(4,3)} ={(1,2),(1,3),(1,4), (2,1),(2,3),(2,4), (3,1),(3,2),(3,4)} ={(1,2),(1,3), (2,1),(2,3), (3,1),(3,2)} 由条件概率公式得,

条件概率及全概率公式练习题

二、计算题 1.从1, 2, 3,…, 15中,甲、乙两人各任取一数(不重复),已知甲取到的数是5的倍数,求甲数大于乙数的概率. 解.设事件A表示“甲取到的数比乙大”, 设事件B表示“甲取到的数是5 的倍数”. 则显然所要求的概率为P(A|B). 根据公式 而P(B)=3/15=1/5 , , ∴P(A|B)=9/14. 2. 掷三颗骰子,已知所得三个数都不一样,求含有1点的概率. 解.设事件A表示“掷出含有1的点数”, 设事件B表示“掷出的三个点数都不一样”. 则显然所要求的概率为 P(A|B). 根据公 式 , , ∴

P(A|B)=1/2. 3.袋中有一个白球和一个黑球,一次次地从袋中摸球,如果取出白球,则除把白球放回外再加进一个白球,直至取出黑球为止,求取了N次都没有取到黑球的概率. 1解.设事件A i表示“第i次取到白球”. (i=1,2,…,N) 则根据题意P(A1)=1/2 , P(A2|A1)=2/3, 由乘法公式可知: P(A1A2)=P(A2|A1)P(A1)=1/3. 而P(A3|A1A2)=3/4 , P(A1A2A3)=P(A3|A1A2)P(A1A2)=1/ 4 . 由数学归纳法可以知道 P(A1A2…A N)=1/(N+1). 4. 甲袋中有5只白球, 7 只红球;乙袋中有4只白球, 2只红球.从两个袋子中任取一袋, 然后从所取到的袋子中任取一球,求取到的球是白球的概率. 解.设事件A表示“取到的是甲袋”, 则表示“取到的是乙袋”, 事件B表示“最后取到的是白球”. 根据题意: P(B|A)=5/12 , , P(A)=1/2. ∴ . 5.有甲、乙两袋,甲袋中有3只白球,2只黑球;乙袋中有4只白球,4只黑球.现从甲袋中任取2个球放解.设事件A i表示“从甲袋取的2个球中有i 个白球”,其中i=0,1,2 .

fisher判别法

实验1 Fisher 线性判别实验 一、实验目的 应用统计方法解决模式识别问题的困难之一是维数问题,在低维空间行得通的方法,在高维空间往往行不通。因此,降低维数就成为解决实际问题的关键。Fisher 的方法,实际上涉及维数压缩。 如果要把模式样本在高维的特征向量空间里投影到一条直线上,实际上就是把特征空间压缩到一维,这在数学上容易办到。问题的关键是投影之后原来线性可分的样本可能变得混杂在一起而无法区分。在一般情况下,总可以找到某个最好的方向,使样本投影到这个方向的直线上是最容易分得开的。如何找到最好的直线方向,如何实现向最好方向投影的变换,是Fisher 法要解决的基本问题。这个投影变换就是我们寻求的解向量* w 本实验通过编制程序体会Fisher 线性判别的基本思路,理解线性判别的基本思想,掌握Fisher 线性判别问题的实质。 二、实验原理 1.线性投影与Fisher 准则函数 各类在d 维特征空间里的样本均值向量: ∑∈= i k X x k i i x n M 1 ,2,1=i (4.5-2) 通过变换w 映射到一维特征空间后,各类的平均值为: ∑∈= i k Y y k i i y n m 1,2,1=i (4.5-3) 映射后,各类样本“类内离散度”定义为: 22 ()k i i k i y Y S y m ∈= -∑,2,1=i (4.5-4) 显然,我们希望在映射之后,两类的平均值之间的距离越大越好,而各类的样本类内离散度越小越好。因此,定义Fisher 准则函数: 2 122 2 12 ||()F m m J w s s -=+ (4.5-5) 使F J 最大的解* w 就是最佳解向量,也就是Fisher 的线性判别式。

模式识别fisher线性判别作业

实验容使用FISHER线性判别来对树叶进行分类指导老师_王旭初_____ 一.实验目的 利用FISHER线性判别函数来对桃树叶子和芒果树叶子进行分类,将这两者若干片树叶进行一定特点分类,做出函数图,使得我们容易分析这两者之间的异同。 二.数据获取方式 实验过程中将会使用到FISHER线性判别函数法,MATLAB实验仿真程序。通过实验MATLAB程序来设计一个FISHER线性判别分类器,将实验前收集到的两种树叶的若干片叶子的数据输入分类器,运行后得出一个分类仿真图形,从而可以得出其叶子间的异同点。 三.实验原理 Fisher线性判别分析的基本思想:通过寻找一个投影方向(线性变换,线性组合),将高维问题降低到一维问题来解决,并且要求变换后的一维数据具有如下性质:同类样本尽可能聚集在一起,不同类的样本尽可能地远。 Fisher线性判别分析,就是通过给定的训练数据,确定投影方向W和阈值y0,即确定

线性判别函数,然后根据这个线性判别函数,对测试数据进行测试,得到测试数据的类别。 线性判别函数的一般形式可表示成 0)(w X W X g T += 其中 ????? ??=d x x X Λ1 ?????? ? ??=d w w w W Λ21 根据Fisher 选择投影方向W 的原则,即使原样本向量在该方向上的投影能兼顾类间分布尽可能分开,类样本投影尽可能密集的要求,用以评价投影方向W 的函数为: 2 2 2122 1~~)~~()(S S m m W J F +-= )(211 *m m S W W -=- 上面的公式是使用Fisher 准则求最佳法线向量的解,该式比较重要。另外, 该式这种形式的运算,我们称为线性变换,其中21m m -式一个向量,1 -W S 是W S 的逆矩阵,如21m m -是d 维,W S 和1-W S 都是d ×d 维,得到的*W 也是一个d 维的向量。 向量*W 就是使Fisher 准则函数)(W J F 达极大值的解,也就是按Fisher 准则将d 维X 空间投影到一维Y 空间的最佳投影方向,该向量*W 的各分量值是对原d 维特征向量求加权和的权值。

Fisher判别

Fisher判别 理论,编程步骤和优缺点 1.理论 判别分析是用于判别个体所属群体的一种统计方法,判别分析的特点是根据已掌握的、历史上每个类别的若干样本的数据信息,总结出客观事物分类的规律性,建立判别公式和判别准则。然后,当遇到新的样本点时,只要根据总结出来的判别公式和判别准则,就能判别该样本点所属的类别。判别分析是一种应用性很强的统计数据分析方法。 Fisher判别 (1)借助方差分析的思想构造一个线性判别函数: (2)确定判别函数系数时要求使得总体之间区别最大,而使每个总体内部的离差最小。 (3)从几何的角度看,判别函数就是p维向量X在某种方向上的投影。使得变换后的数据同类别的点“尽可能聚在一起”,不同类别的点“尽可能分离”,以此达到分类的目的。 两类Fisher判别示意图

(1)如果有多个类别, Fisher 判别可能需要两个或者更多的判别函数才能完成分类。 (2)一般来说判别函数的个数等于分类的个数减一。 (3)得到判别函数后,计算待判样品的判别函数值,根据判别函数的值计算待判样品到各类的重心的距离,从而完成分类。 2.编程步骤 ① 把来自两类 21/w w 的训练样本集X 分成1w 和2w 两个子集1X 和2X 。 G1 G2 X

② 由∑∈=i k X x k i i x n M 1,2,1=i ,计算i M 。 ③ 由T i X x k i k i M x M x S i k ))((--= ∑=计算各类的类内离散度矩阵i S ,2,1=i 。 ④ 计算类内总离散度矩阵21S S S w +=。 ⑤ 计算 w S 的逆矩阵1 -w S 。 ⑥ 由)(211*M M S w w -=-求解*w 。 3.优点 (1)一般对于线性可分的样本,总能找到一个投影方向,使得降维后的样本仍然线性可分,而且可分性更好即不同类别的样本之间的距离竟可能的远,同一类别的尽可能的集中分布。 (2)Fisher 方法可以直接求解法向量。 (3)Fisher 的线性判别不仅适用于确定性的模式分类器的训练,而且对于随机的模机也是适用的,Fisher 还可以推广到多类问题中去。 缺点 (1)如果M1=M2,W=0.则这样的样本线性不可分;M1!=M2,未必线性可分;SW 不可逆,未必不可分。

判别分析中Fisher判别法的应用

1 绪 论 1.1课题背景 随着社会经济不断发展,科学技术的不断进步,人们已经进入了信息时代,要在大量的信息中获得有科学价值的结果,从而统计方法越来越成为人们必不可少的工具和手段。多元统计分析是近年来发展迅速的统计分析方法之一,应用于自然科学和社会各个领域,成为探索多元世界强有力的工具。 判别分析是统计分析中的典型代表,判别分析的主要目的是识别一个个体所属类别的情况下有着广泛的应用。潜在的应用包括预测一个公司是否成功;决定一个学生是否录取;在医疗诊断中,根据病人的多种检查指标判断此病人是否有某种疾病等等。它是在已知观测对象的分类结果和若干表明观测对象特征的变量值的情况下,建立一定的判别准则,使得利用判别准则对新的观测对象的类别进行判断时,出错的概率很小。而Fisher 判别方法是多元统计分析中判别分析方法的常用方法之一,能在各领域得到应用。通常用来判别某观测量是属于哪种类型。在方法的具体实现上,采用国内广泛使用的统计软件SPSS (Statistical Product and Service Solutions ),它也是美国SPSS 公司在20世纪80年代初开发的国际上最流行的视窗统计软件包之一 1.2 Fisher 判别法的概述 根据判别标准不同,可以分为距离判别、Fisher 判别、Bayes 判别法等。Fisher 判别法是判别分析中的一种,其思想是投影,Fisher 判别的基本思路就是投影,针对P 维空间中的某点x=(x1,x2,x3,…,xp)寻找一个能使它降为一维数值的线性函数y(x): ()j j x C x ∑=y

然后应用这个线性函数把P 维空间中的已知类别总体以及求知类别归属的样本都变换为一维数据,再根据其间的亲疏程度把未知归属的样本点判定其归属。这个线性函数应该能够在把P 维空间中的所有点转化为一维数值之后,既能最大限度地缩小同类中各个样本点之间的差异,又能最大限度地扩大不同类别中各个样本点之间的差异,这样才可能获得较高的判别效率。在这里借用了一元方差分析的思想,即依据组间均方差与组内均方差之比最大的原则来进行判别。 1.3 算法优缺点分析 优点:(1)一般对于线性可分的样本,总能找到一个投影方向,使得降维后样本仍然线性可分,而且可分性更好即不同类别的样本之间的距离尽可能远,同一类别的样本尽可能集中分布。 (2)Fisher 方法可直接求解权向量*w ; (3)Fisher 的线性判别式不仅适用于确定性模式分类器的训练,而且对于随机模式也是适用的,Fisher 还可以进一步推广到多类问题中去 缺点: (1)如果21M M =,0*=w ,则样本线性不可分; 21M M ≠,未必线性可分; w S 不可逆,未必不可分。 (2)对线性不可分的情况,Fisher 方法无法确定分类 2 实验原理 2.1 线性投影与Fisher 准则函数

条件概率与全概率公式-2020-2021学年高中数学新教材人教A版选择性必修配套提升训练(原卷版)

专题30 条件概率与全概率公式 一、单选题 1.(2020·河南南阳高二二模(理))根据历年气象统计资料,某地四月份吹东风的概率为930 ,下雨的概率为 1130,既吹东风又下雨的概率为830 .则在下雨条件下吹东风的概率为( ) A .25 B .89 C .811 D .911 2.(2020·安徽省六安中学高二期中(理))根据以往数据统计,某酒店一商务房间1天有客人入住的概率为45,连续2天有客人入住的概率为 35,在该房间第一天有客人入住的条件下,第二天也有客人入住的概率为( ) A .13 B .12 C .35 D .34 3.(2020·河南开封高三二模(理))已知正方形ABCD ,其内切圆I 与各边分别切于点E ,F ,G 、H ,连接EF ,FG ,GH ,HE .现向正方形ABCD 内随机抛掷一枚豆子,记事件A :豆子落在圆I 内,事件B :豆子落在四边形EFGH 外,则()P B A =( ) A .2π B .21π- C .12 D .π142 - 4.(2020·河南高二期末(理))把一枚硬币连续抛两次,记“第一次出现正面”为事件A ,“第二次出现正面”为事件B ,则()P B A =( ) A .12 B .14 C .16 D .18 5.(2020·陕西临渭高二期末(文))已知()1P B|A 2= ,()35P A =,()P AB 等于( ) A .56 B .910 C .310 D .110 6.(2020·黑龙江南岗哈师大附中高二期末(理))从1,2,3,4,5,6,7,8,9中不放回地依次取2个数,事件A 为“第一次取到的是奇数”,B 为“第二次取到的是3的整数倍”,则(|)P B A =( ) A .38 B .1340 C .1345 D .34 7.(2020·西夏宁夏大学附属中学高二月考(理))将两颗骰子各掷一次,设事件A =“两个点数不相同”, B =“至少出现一个6点”,则概率()|P A B 等于( )

相关主题
文本预览
相关文档 最新文档