[Insight-users] ExpectationMaximizationMixtureModelEstimator use of WeightedMeanSampleFilter

Ariel Hernán Curiale curiale at gmail.com
Mon Jul 22 03:54:07 EDT 2013


Hi,

If I'm not wrong the EM has n Models (GaussianMixtureModel). The EM class use the Model to create the pdf according to the Membership function of the model (GaussianMembershipFunction class). Also, the MixtureModel is who update the parameters of the model using the WeightedMean (i.e the mean estimator). Inside the class GaussianMixtureModel, in the method GenerateData the WeightedMean estimator is called (m_MeanEstimator->Update()).



__________________________________
| Ariel Hernán Curiale Ph.D Student
| ETSI Telecomunicación
| Universidad de Valladolid
| Campus Miguel Delibes
| 47011 Valladolid, Spain
| Phone: 983-423000 ext. 5590
| Web: www.curiale.com.ar
|_________________________________

El 18/07/2013, a las 18:12, smrolfe at u.washington.edu escribió:

> Hello,
> 
> I am trying to resolve the error described below in my implementation of the ExpectationMaximizationMixtureModelEstimator for a 3D data set.  I'm trying to find out the relationship between the ExpectationMaximizationMixtureModelEstimator and the WeightedMeanSampleFilter.  I read through the source code and it is not explicitly called in the .hxx file.  If you have any leads on the use of this filter, please let me know.
> 
> Thanks,
> Sara
> 
>> On Mon, 1 Jul 2013, smrolfe at u.washington.edu wrote:
>> 
>>> Hello,
>>> I am using the ExpectationMaximizationMixtureModelEstimator filter to estimate a mixture model from a set of observations.  I am closely following the example
>>> ExpectationMaximizationMixtureModelEstimator_2D.cxx
>>> When I run the program, I am getting the error:
>>> Description: itk::ERROR: WeightedMeanSampleFilter(00000000038A66C0): Total weight was too close to zero. Value = 0
>>> It looks like this filter computes the mean of a set of weighted measurement vectors, but I'm not clear on what might cause the total weight to be zero.  I'd appreciate any thoughts.
>>> An excerpt of my code is below.
>>> Thanks!
>>> Sara
>>> typedef itk::Array< double > ParametersType;
>>> typedef itk::Statistics::GaussianMixtureModelComponent< SampleType > ComponentType;
>>> typedef itk::Statistics::ExpectationMaximizationMixtureModelEstimator< SampleType > EstimatorType;
>>> SampleType::Pointer sample = SampleType::New();
>>> for (int pointIter = 0; pointIter < pointArray[i].size(); pointIter++){ //put all points in current histogram bin in the sample vector
>>>             sample->PushBack( pointArray[i][pointIter] ); //pointArray[i] is a vector of measurement vectors
>>> }
>>> int distributionNumber = initialParameters.meanVectors[i].size();
>>> int paramNumber = (MeasurementVectorLength)+(MeasurementVectorLength*MeasurementVectorLength);
>>> ParametersType params( paramNumber );
>>> std::vector< ParametersType > inputParameters( distributionNumber );
>>> itk::Array< double > initialProportions(distributionNumber);
>>> for(int j = 0; j < distributionNumber; j++){         // for each distribution in initial estimate
>>> initialProportions[j] = initialParameters.subHistogram[i][j];   // set initial proportions to the sub-bin size
>>> for(int k = 0; k < MeasurementVectorLength; k++){ // assign values in distribution parameter matrix
>>> params[k] = initialParameters.meanVectors[i][j][k];
>>> }
>>> int paramCount = MeasurementVectorLength;
>>> for(int l=0; l < MeasurementVectorLength; l++){
>>> for(int m=0; m < MeasurementVectorLength; m++){
>>> params[paramCount] = initialParameters.covarianceMats[i][j][l][m];
>>> paramCount++;
>>> }
>>> }
>>> inputParameters[j] = params; // push parameters for current distribution into parameter vector
>>> }
>>> std::vector< ComponentType::Pointer > components;                       // Create the Gausian model components
>>> for ( unsigned int k = 0 ; k < distributionNumber ; k++ ){
>>> components.push_back( ComponentType::New() );
>>> (components[k])->SetSample( sample );
>>> (components[k])->SetParameters( inputParameters[k] );
>>> }
>>> EstimatorType::Pointer estimator = EstimatorType::New();         // set up estimator for bin i
>>> estimator->SetSample( sample );
>>> estimator->SetMaximumIteration( 200 );
>>> estimator->SetInitialProportions( initialProportions );
>>> for ( unsigned int k = 0 ; k < distributionNumber ; k++){
>>> estimator->AddComponent( (ComponentType::Superclass*)(components[k]).GetPointer() );
>>> }
>>> try{
>>> estimator->Update();
>>> }catch( itk::ExceptionObject & err ){
>>> std::cerr << "ExceptionObject caught !" << std::endl;
>>> std::cerr << err << std::endl;
>>> }
>> 
>> 
> 
> _____________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
> 
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130722/2dc3ca9e/attachment.htm>


More information about the Insight-users mailing list