1 #ifndef __fpa__Base__Functors__GaussianModel__hxx__
2 #define __fpa__Base__Functors__GaussianModel__hxx__
4 // -------------------------------------------------------------------------
5 template< class _TInput, class _TOutput >
6 typename fpa::Base::Functors::GaussianModel< _TInput, _TOutput >::
7 TOutput fpa::Base::Functors::GaussianModel< _TInput, _TOutput >::
8 Evaluate( const TInput& x ) const
10 double v = double( x );
11 double d = double( 0 );
14 double N = double( this->m_N );
15 double m = this->m_S1 / N;
17 ( this->m_S2 - ( ( this->m_S1 * this->m_S1 ) / N ) ) /
25 if( d <= double( 1.5 ) ) // 2sigma
51 TOutput r = TOutput( 0 );
52 if( this->m_Model->GetNumberOfSamples( ) > this->m_SupportSize )
54 r = this->m_Model->SquaredMahalanobis( TOutput( x ) );
55 if( r <= TOutput( 1 ) )
56 this->m_Model->AddSample( TOutput( x ) );
60 this->m_Model->AddSample( TOutput( x ) );
61 if( this->m_Model->GetNumberOfSamples( ) > 2 )
62 r = this->m_Model->SquaredMahalanobis( TOutput( x ) );
65 if( r < this->m_MinimumCost )
66 return( this->m_MinimumCost );
72 // -------------------------------------------------------------------------
73 template< class _TInput, class _TOutput >
74 fpa::Base::Functors::GaussianModel< _TInput, _TOutput >::
80 m_MinimumCost( TOutput( 1e-10 ) )
84 this->m_Model = TModel::New( );
86 this->m_S1 = double( 0 );
87 this->m_S2 = double( 0 );
91 // -------------------------------------------------------------------------
92 template< class _TInput, class _TOutput >
93 fpa::Base::Functors::GaussianModel< _TInput, _TOutput >::
98 #endif // __fpa__Base__Functors__GaussianModel__hxx__