1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- /**
- * @file RunningStatVector.h
- * @brief B. P. Welford Computation of Mean and Variance download at: http://www.johndcook.com/standard_deviation.html
- * @author Michael Koch
- * @date 19/01/2010
- */
- #ifndef RunningStatVectorINCLUDE
- #define RunningStatVectorINCLUDE
- #include "vislearning/baselib/RunningStat.h"
- #include <core/vector/VectorT.h>
- namespace OBJREC
- {
- /** @brief online statistics */
- class RunningStatVector
- {
- public:
- RunningStatVector(size_t n=0) :
- m_n(0),size(n)
- {
- }
- ~RunningStatVector();
- /** clear the current statistics */
- void Clear();
- /** add a new data element */
- void Push(NICE::Vector x);
- /** get number of data elements */
- size_t NumDataValues() const;
- /** get vector size */
- size_t Size() const;
- /** get mean value */
- NICE::Vector Mean() const;
- /** get variance */
- NICE::Vector Variance() const;
- /** get standard deviation */
- NICE::Vector StandardDeviation() const;
- private:
- size_t m_n;
- size_t size;
- std::vector<RunningStat *> datavector;
- };
- }
- #endif
|