Statistics.h
Go to the documentation of this file.
1//===========================================================================
2/*!
3 *
4 *
5 * \brief some functions for vector valued statistics like mean, variance and covariance
6 *
7 *
8 *
9 * \author O.Krause, C. Igel
10 * \date 2010-2013
11 *
12 *
13 * \par Copyright 1995-2017 Shark Development Team
14 *
15 * <BR><HR>
16 * This file is part of Shark.
17 * <https://shark-ml.github.io/Shark/>
18 *
19 * Shark is free software: you can redistribute it and/or modify
20 * it under the terms of the GNU Lesser General Public License as published
21 * by the Free Software Foundation, either version 3 of the License, or
22 * (at your option) any later version.
23 *
24 * Shark is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * GNU Lesser General Public License for more details.
28 *
29 * You should have received a copy of the GNU Lesser General Public License
30 * along with Shark. If not, see <http://www.gnu.org/licenses/>.
31 *
32 */
33//===========================================================================
34#ifndef SHARK_DATA_STATISTICS_H
35#define SHARK_DATA_STATISTICS_H
36
37#include <shark/Data/Dataset.h>
38
39/**
40* \ingroup shark_globals
41*
42* @{
43*/
44
45namespace shark{
46
47//! Calculates the mean and variance values of the input data
48template<class Vec1T,class Vec2T,class Vec3T, class Device>
50(
51 Data<Vec1T> const& data,
52 blas::vector_container<Vec2T, Device>& mean,
53 blas::vector_container<Vec3T, Device>& variance
54);
55//! Calculates the mean, variance and covariance values of the input data
56template<class Vec1T,class Vec2T,class MatT, class Device>
58(
59 Data<Vec1T> const& data,
60 blas::vector_container<Vec2T, Device>& mean,
61 blas::matrix_container<MatT, Device>& variance
62);
63
64//! Calculates the mean vector of the input vectors.
65template<class VectorType>
67
68template<class VectorType>
70 return mean(static_cast<Data<VectorType> const&>(data));
71}
72
73//! Calculates the variance vector of the input vectors
74template<class VectorType>
76
77//! Calculates the covariance matrix of the data vectors
78template<class VectorType>
79blas::matrix<typename VectorType::value_type> covariance(Data<VectorType> const& data);
80
81}
82/** @}*/
83#include "Impl/Statistics.inl"
84
85#endif