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( 2 ) ) // 2sigma
48 std::cout << v << " " << d << std::endl;
52 TOutput r = TOutput( 0 );
53 if( this->m_Model->GetNumberOfSamples( ) > this->m_SupportSize )
55 r = this->m_Model->SquaredMahalanobis( TOutput( x ) );
56 if( r <= TOutput( 1 ) )
57 this->m_Model->AddSample( TOutput( x ) );
61 this->m_Model->AddSample( TOutput( x ) );
62 if( this->m_Model->GetNumberOfSamples( ) > 2 )
63 r = this->m_Model->SquaredMahalanobis( TOutput( x ) );
66 if( r < this->m_MinimumCost )
67 return( this->m_MinimumCost );
73 // -------------------------------------------------------------------------
74 template< class _TInput, class _TOutput >
75 fpa::Base::Functors::GaussianModel< _TInput, _TOutput >::
81 m_MinimumCost( TOutput( 1e-10 ) )
85 this->m_Model = TModel::New( );
87 this->m_S1 = double( 0 );
88 this->m_S2 = double( 0 );
92 // -------------------------------------------------------------------------
93 template< class _TInput, class _TOutput >
94 fpa::Base::Functors::GaussianModel< _TInput, _TOutput >::
99 #endif // __fpa__Base__Functors__GaussianModel__hxx__