⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 labman1.tex

📁 一本关于dsp的原著教材
💻 TEX
📖 第 1 页 / 共 4 页
字号:
\documentclass[twoside,a4paper,titlepage]{article}\usepackage{array,amsmath,amssymb,rotating,epsfig,fancyheadings}\newcommand{\mat}[1]{{\tt >> #1} \\}\newcommand{\com}[1]{{\tt #1}}\newcommand{\expl}[1]{%\begin{turn}{180}%\parbox{\textwidth}{\em #1}%\end{turn}%}\newcommand{\tit}[1]{{\noindent \bf #1 \\}}\newcommand{\tab}{\hspace{1em}}\setlength{\hoffset}{-1in}\setlength{\voffset}{-1in}\setlength{\topskip}{0cm}\setlength{\headheight}{0cm}\setlength{\headsep}{0cm}\setlength{\textwidth}{16cm}\setlength{\evensidemargin}{2.5cm}\setlength{\oddsidemargin}{2.5cm}\setlength{\textheight}{24.7cm}\setlength{\topmargin}{1.5cm}\setlength{\headheight}{0.5cm}\setlength{\headsep}{0.5cm}\pagestyle{fancyplain}\begin{document}\begin{titlepage}\setcounter{page}{-1}\centerline{Ecole Polytechnique F\'ed\'erale de Lausanne}\vspace{5cm}\begin{center}\hugeSession 1/2\,: \\Introduction to Gaussian Statistics \\and Statistical Pattern Recognition\end{center}\vfill\centerline{\includegraphics[width=7cm]{cover.eps.gz}}\vfill\noindent\begin{tabular}{lll}Course\,: & Speech processing and speech recognition & \\& & \\Teacher\,: & Prof. Herv\'e Bourlard \hspace{1cm} & {\tt bourlard@idiap.ch} \\& & \\Assistants\,: & Sacha Krstulovi\'c & {\tt sacha@idiap.ch}\\ & Mathew Magimai-Doss & {\tt mathew@idiap.ch} \end{tabular}\end{titlepage}\thispagestyle{empty}%%%%%%%%%%%%%%%%%%\section*{Guidelines}%%%%%%%%%%%%%%%%%%The following lab manual is structured as follows\,:\begin{itemize}\item each section corresponds to a theme\item each subsection corresponds to a separate experiment.\end{itemize}The subsections begin with useful formulas and definitions that will be putin practice during the experiments. These are followed by the descriptionof the experiment and by an example of how to realize it in {\sc Matlab}.If you follow the examples literally, you will be able to progress into thelab session without worrying about the experimental implementationdetails. If you have ideas for better {\sc Matlab} implementations, you arewelcome to put them in practice provided you don't loose too much time\,:remember that a lab session is no more than 3 hours long.The subsections also contain questions that you should think about.Corresponding answers are given right after, in case of problem. You canread them right after the question, {\em but}\,: the purpose of this lab isto make you\medskip\centerline{\LARGE \bf Think !}\medskipIf you get lost with some of the questions or some of the explanations, DOASK the assistants or the teacher for help\,: they are here to make the courseunderstood. There is no such thing as a stupid question, and the onlyobstacle to knowledge is laziness.\bigskipHave a nice lab;\hfill Teacher \& Assistants \hspace{2cm}\vfill%%%%%%%%%%%%%%%%%%\section*{Before you begin...}%%%%%%%%%%%%%%%%%%If this lab manual has been handed to you as a hardcopy\,:\begin{enumerate}\item get the lab package from \\	\hspace{2cm}{\tt ftp.idiap.ch/pub/sacha/labs/Session1.tgz}\item un-archive the package\,: \\	{\tt \% gunzip Session1.tgz \\	\% tar xvf Session1.tar}\item change directory\,: \\	{\tt \% cd session1}\item start {\sc Matlab}\,: \\	{\tt \% matlab }\end{enumerate}Then go on with the experiments...\vspace{1cm}{\scriptsize\noindentThis document was created by\,: Sacha Krstulovi\'c ({\tt sacha@idiap.ch}).\noindentThis document is currently maintained by\,: Sacha Krstulovi\'c ({\tt sacha@idiap.ch}). Last modification on \today.\noindentThis document is part of the package {\tt Session4.tgz} available by ftp as\,: {\tt ftp.idiap.ch/pub/sacha/labs/Session1.tgz} .}\clearpage\tableofcontents\bigskip%\clearpage%%%%%%%%%%%%%%%%%%\section{Gaussian statistics}%%%%%%%%%%%%%%%%%%%%%%%%%%%\subsection{Samples from a Gaussian density}\label{samples}%%%%%%%%%\subsubsection*{Useful formulas and definitions\,:}\begin{itemize}\item[-] The {\em Gaussian probability density function} (Gaussian pdf) forthe $d$-dimensional random variable $x \circlearrowleft {\calN}(\mu,\Sigma)$ (i.e. variable $x$ following the Gaussian, or Normal,probability law) is given by\,:\[g_{(\mu,\Sigma)}(x) = \frac{1}{\sqrt{2\pi}^d \sqrt{\det\left(\Sigma\right)}}\, e^{-\frac{1}{2} (x-\mu)^T \Sigma^{-1} (x-\mu)}\]where $\mu$ is the mean vector and $\Sigma$ is the variance-covariancematrix. $\mu$ and $\Sigma$ are the {\em parameters} of the Gaussiandistribution. {\em Speech features} (also referred as {\em acousticvectors}) are examples of $d$-dimensional variables, and it is usuallyassumed that they follow a Gaussian distribution.%\item[-] If $x \circlearrowleft {\cal N}(0,I)$ ($x$ follows a normal lawwith zero mean and unit variance; $I$ denotes the identity matrix), and if$y = \sqrt{\Sigma} \, x + \mu$, then $y \circlearrowleft {\calN}(\mu,\Sigma)$.%\item[-] $\sqrt{\Sigma}$ defines the {\em standard deviation} of the randomvariable $x$ ({\em \'ecart-type} in French). Beware\,: this square root ismeant in the {\em matrix sense}.\end{itemize}\subsubsection*{Experiment\,:}Generate a sample $X$ of $N$ points, i.e. $X=\{x_1, x_2,\cdots,x_N\}$, with$N=10000$, coming from a 2-dimensional Gaussian process that has mean\,:\[\mu = \left( \begin{array}{c} 730 \\ 1090 \end{array} \right)\]and variance\,:	\begin{enumerate}	%%%%%	\item 8000 for both dimensions ({\em spherical process}) (sample $X_1$)\,:		\[		\Sigma_1 = \left[ \begin{array}{cc}						8000 & 0 \\						0    & 8000						\end{array} \right]		\]	%%%%%	\item expressed as a {\em diagonal} covariance matrix (sample $X_2$)\,:		\[		\Sigma_2 = \left[ \begin{array}{cc}						8000 & 0 \\						0    & 18500						\end{array} \right]		\]	%%%%%	\item expressed as a {\em full} covariance matrix (sample $X_3$)\,:		\[		\Sigma_3 = \left[ \begin{array}{cc}						8000 & 8400 \\						8400 & 18500						\end{array} \right]		\]	%%%%%	\end{enumerate}%Use the function \com{gausview} (\com{>> help gausview}) to plot theresults as clouds of points in the 2-dimensional plane, and to view thecorresponding 2-dimensional probability density functions (pdfs) in 2D and3D.\subsubsection*{Example\,:}\mat{N = 10000;}\mat{mu = [730 1090]; sigma\_1 = [8000 0; 0 8000];}\mat{X1 = randn(N,2) * sqrtm(sigma\_1) + repmat(mu,N,1);}\mat{gausview(X1,mu,sigma\_1,'Sample X1');}%Repeat the three previous steps for the two other Gaussians. Use the radiobuttons to switch the plots on/off. Use the ``view'' buttons to switchbetween 2D and 3D. Use the mouse to rotate the plot.{\bf \noindent Note\,:} if you don't know what one of the cited {\sc Matlab}command does, use \\\mat{help {\it command}}to get some help. If the help doesn't make it clearer, ask the assistants.\subsubsection*{Question\,:}By simple inspection of 2D views of the data and of the corresponding pdfcontours, how can you tell which sample corresponds to a spherical process,which sample corresponds to a pdf with a diagonal covariance, and which toa pdf with a full covariance~?\subsubsection*{Answer\,:}\expl{The cloud of points and the pdf contours corresponding to $\Sigma_1$are circular, because in this case the first and the second dimension ofthe vectors are independent. As a matter of fact, they have a nullcovariance\,:\[ {\cal E}\left[(x_{d1}-\mu_{d1})^T (x_{d2}-\mu_{d2})\right] = 0 \]They are {\em orthogonal} in the statistical sense, which transposes to ageometric sense (the expectation is a scalar product of random variables; anull scalar product means orthogonality). Intuitively, you can alsoconsider that a null covariance means no sharing of information between thetwo dimensions\,: they can evolve independently in a Gaussian way alongtheir respective axes. Besides, the variance is the same in bothdimensions, which indicates an equivalent spread of the data along bothaxes. Hence the circular blob of data points and the name ``sphericalprocess''.\medskip\tab The cloud of points and the pdf contours corresponding to $\Sigma_2$are elliptic, with their axes parallel to the abscissa and ordinateaxes. This is because the first and the second dimension are stillindependent (their covariance is null again), but this time the variance isdifferent along both dimensions.\medskip\tab For $\Sigma_3$, the covariance of both dimensions is not null, so theprincipal axes of the ellipses are not aligned with the abscissa andordinate axes.}\pagebreak%%%%%%%%%\subsection{Gaussian modeling\,: mean and variance of a sample}%%%%%%%%%\subsubsection*{Useful formulas and definitions\,:}\begin{itemize}\item[-] Mean estimator\,: $\hat{\mu} = \frac{1}{N} \sum_{i=1}^{N} x_i$\item[-] Unbiased covariance estimator\,: $ \hat{\Sigma} = \frac{1}{N-1} \;\sum_{i=1}^{N} (x_i-\mu)^T (x_i-\mu) $\end{itemize}\subsubsection*{Experiment\,:}Take the set $X_3$ of 10000 points generated from ${\calN}(\mu,\Sigma_3)$. Compute an estimate $\hat{\mu}$ of its mean and anestimate $\hat{\Sigma}$ of its variance\,:\begin{enumerate}\item with all the available points \hspace{1cm}$\hat{\mu}_{(10000)}=$\hspace{3.5cm}$\hat{\Sigma}_{(10000)} =$\vspace{0.8cm}\item with only 1000 points \hspace{2cm}$\hat{\mu}_{(1000)}=$\hspace{3.7cm}$\hat{\Sigma}_{(1000)} =$\vspace{0.8cm}\item with only 100 points \hspace{2.1cm}$\hat{\mu}_{(100)}=$\hspace{3.9cm}$\hat{\Sigma}_{(100)} =$\vspace{0.8cm}\end{enumerate}Compare the estimated value $\hat{\mu}$ with the original value of $\mu$ bymeasuring the Euclidean distance that separates them. Compare the estimatedvalue $\hat{\Sigma}$ with the original value of $\Sigma_3$ by measuring thematrix 2-norm of their difference ($\parallel A-B \parallel_2$ constitutesa measure of similarity of two matrices $A$ and $B$; use {\sc Matlab}'s\com{norm} command).\subsubsection*{Example\,:}In the case of 1000 points (case 2.)\,: \\\mat{X = X3(1:1000,:);}\mat{N = size(X,1)}\com{>> mu\_1000 = sum(X)/N} \,\,{\it -or-}\,\, \mat{mu\_1000 = mean(X)}\mat{sigma\_1000 = (X - repmat(mu\_1000,N,1))' * (X - repmat(mu\_1000,N,1)) / (N-1)}\,\,{\it -or-}\,\, \mat{sigma\_1000 = cov(X)}\noindent\mat{\% Comparison of the values:}\mat{e\_mu =  sqrt( (mu\_1000 - mu) * (mu\_1000 - mu)' )}\mat{\% (This is the Euclidean distance between mu\_1000 and mu)}\mat{e\_sigma = norm( sigma\_1000 - sigma\_3 )}\com{>> \% (This is the 2-norm of the difference between sigma\_1000 and sigma\_3)}\subsubsection*{Question\,:}When comparing the estimated values $\hat{\mu}$ and $\hat{\Sigma}$ with theoriginal values of $\mu$ and $\Sigma_3$ (using the Euclidean distance andthe matrix 2-norm), what can you observe~?\subsubsection*{Answer\,:}\expl{The more points, the better the estimates. Furthermore, an accuratemean estimate requires less points than an accurate variance estimate. Ingeneral, in any data-based pattern classification technique (as opposed toknowledge-based techniques or expert systems), it is very important to haveenough training examples to estimate some accurate models of the data.}\pagebreak%%%%%%%%%\subsection{Likelihood of a sample with respect to a Gaussian model}\label{like}%%%%%%%%%\subsubsection*{Useful formulas and definitions\,:}\begin{itemize}\item[-] {\em Likelihood}\,: the likelihood of a sample point given aGaussian model (i.e. given a set of parameters $\Theta = (\mu,\Sigma)$) isthe value of the probability density function for that point. In the caseof Gaussian models, this amounts to compute the value of the pdf expressiongiven at the beginning of section~\ref{samples}.\item[-] {\em Joint likelihood}\,: for a set of independent identicallydistributed (i.i.d.) points, say $X = \{ x_1, x_2, \cdots, x_N \}$, thejoint (or total) likelihood is the product of the likelihood for eachpoint. For instance, in the Gaussian case\,:\[ p(X|\Theta) = \prod_{i=1}^{N} p(x_i|\Theta) =

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -