Edinburgh Speech Tools 2.4-release
EST_multistats.h
1/*************************************************************************/
2/* */
3/* Centre for Speech Technology Research */
4/* University of Edinburgh, UK */
5/* Copyright (c) 1995,1996 */
6/* All Rights Reserved. */
7/* */
8/* Permission is hereby granted, free of charge, to use and distribute */
9/* this software and its documentation without restriction, including */
10/* without limitation the rights to use, copy, modify, merge, publish, */
11/* distribute, sublicense, and/or sell copies of this work, and to */
12/* permit persons to whom this work is furnished to do so, subject to */
13/* the following conditions: */
14/* 1. The code must retain the above copyright notice, this list of */
15/* conditions and the following disclaimer. */
16/* 2. Any modifications must be clearly marked as such. */
17/* 3. Original authors' names are not deleted. */
18/* 4. The authors' names are not used to endorse or promote products */
19/* derived from this software without specific prior written */
20/* permission. */
21/* */
22/* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */
23/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
24/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
25/* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */
26/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
27/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
28/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
29/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
30/* THIS SOFTWARE. */
31/* */
32/*************************************************************************/
33/* Author : Paul Taylor */
34/* Date : July 1995 */
35/*-----------------------------------------------------------------------*/
36/* Basic Multivariate Statistical Function Prototypes */
37/* */
38/*=======================================================================*/
39#ifndef __Multistats_H__
40#define __Multistats_H__
41
42#include "EST_FMatrix.h"
43#include "EST_types.h"
44
45float mean(EST_FVector &m);
46
48EST_FVector sample_variance(EST_FMatrix &m);
49EST_FVector sample_stdev(EST_FMatrix &m);
50
51EST_FMatrix sample_covariance(EST_FMatrix &m);
52EST_FMatrix sample_correlation(EST_FMatrix &m);
53
54EST_FMatrix euclidean_distance(EST_FMatrix &m);
55EST_FMatrix penrose_distance(EST_FMatrix &m);
56
57
58EST_FMatrix normalise(EST_FMatrix &m, EST_FVector &sub, EST_FVector &div);
59
60EST_FMatrix penrose_distance(EST_FMatrix &gu, EST_FVector &gv);
61EST_FMatrix mahalanobis_distance(EST_FMatrix &gu, EST_FMatrix &v);
62EST_FMatrix population_mean(EST_FMatrix *in, int num_pop);
63EST_FMatrix add_populations(EST_FMatrix *in, int num_pop);
64
65EST_FMatrix confusion(EST_StrStr_KVL &list, EST_StrList &lex);
66void print_confusion(const EST_FMatrix &a, EST_StrStr_KVL &list,
67 EST_StrList &lex);
68
69#define OLS_IGNORE 100
70int ols(const EST_FMatrix &X,const EST_FMatrix &Y, EST_FMatrix &coeffs);
71int robust_ols(const EST_FMatrix &X,
72 const EST_FMatrix &Y,
73 EST_FMatrix &coeffs);
74int robust_ols(const EST_FMatrix &X,
75 const EST_FMatrix &Y,
76 EST_IVector &included,
77 EST_FMatrix &coeffs);
78int stepwise_ols(const EST_FMatrix &X,
79 const EST_FMatrix &Y,
80 const EST_StrList &feat_names,
81 float limit,
82 EST_FMatrix &coeffs,
83 const EST_FMatrix &Xtest,
84 const EST_FMatrix &Ytest,
85 EST_IVector &included);
86int ols_apply(const EST_FMatrix &samples,
87 const EST_FMatrix &coeffs,
88 EST_FMatrix &res);
89int ols_test(const EST_FMatrix &real,
90 const EST_FMatrix &predicted,
91 float &correlation,
92 float &rmse);
93
94#endif // __Multistats_H__