Example #1
0
globle void *GetEnvironmentByIndex(
  unsigned long environmentIndex)
  {
   struct environmentData *theEnvironment;

   theEnvironment = FindEnvironment(environmentIndex);

   return(theEnvironment);
  }
Example #2
0
globle intBool SetCurrentEnvironmentByIndex(
  unsigned long environmentIndex)
  {
   struct environmentData *theEnvironment;

   theEnvironment = FindEnvironment(environmentIndex);

   if (theEnvironment == NULL)
     { return(FALSE); }

   SetCurrentEnvironment(theEnvironment);

   return(TRUE);
  }
CGibbsSamplingInfEngine::CGibbsSamplingInfEngine( const CStaticGraphicalModel
                                                 *pGraphicalModel )
                                                 :CSamplingInfEngine( pGraphicalModel ),
                                                 m_queryNodes( 0 ),
                                                 m_queryes(0),
                                                 m_queryFactors(0),
                                                 m_pPotMPE(NULL),
                                                 m_bUsingDSep(false)
                                                 
                                                 
{
  m_bMaximize = 0;
  Initialization();
  m_SoftMaxGaussianFactors.resize(pGraphicalModel->GetNumberOfNodes(), NULL);
  FindEnvironment(&m_environment);
  m_NSamplesForSoftMax = 10;
  m_MaxNSamplesForSoftMax = 1000000;
}
PNL_USING



CSamplingInfEngine::CSamplingInfEngine( const CStaticGraphicalModel
				       *pGraphicalModel )
				       :CInfEngine( itGibbsSampling,
				       pGraphicalModel ),
				       
				       m_maxTime(600),
				       m_barnin(10),
				       m_nStreams(1),
				       m_pEvidences(0),
				       m_potsToSampling(0),
				       m_ndsForSampling(0),
				       m_mixtureNds(0),
				       m_allNdsIsTab(CheckIsAllNdsTab()),
				       m_sampleIsNeed(0)
				       
				       
				       
				       
				       
{
    EModelTypes mt;
    mt = GetModel()->GetModelType();
    
    if( mt != mtBNet && mt != mtMNet && mt != mtMRF2  )
    {
        PNL_THROW( CNotImplemented, " not emplemented for this model ")
    }
    
    
    FindNdsForSampling( &m_ndsForSampling, &m_mixtureNds );
    FindEnvironment(&m_environment);
    CreateSamplingPotentials( &m_potsToSampling );
    
}