本文整理汇总了C++中CFactor::GetFactorType方法的典型用法代码示例。如果您正苦于以下问题:C++ CFactor::GetFactorType方法的具体用法?C++ CFactor::GetFactorType怎么用?C++ CFactor::GetFactorType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFactor
的用法示例。
在下文中一共展示了CFactor::GetFactorType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DimOfModel
int CBICLearningEngine::DimOfModel(const CStaticGraphicalModel *pModel)
{
/*
compute dimension of the model in (d)
it using in BIC criterion:
BIC = LogLic - 0.5*d*log(N)
*/
int nParam = pModel->GetNumberOfFactors();
CFactor *param = NULL;
int dimOfModel = 0;
int dim = 1;
CMatrix<float> *matrix;;
for (int i = 0; i < nParam; i++)
{
dim = 1;
param = pModel->GetFactor(i);
switch (param->GetFactorType())
{
case ftCPD:
{
switch (param->GetDistributionType())
{
case dtTabular:
{
matrix = param->GetMatrix(matTable);
int size;
const int *ranges;
static_cast<CNumericDenseMatrix<float>*>(matrix)->
GetRanges(&size, &ranges);
for(int j=0; j < size - 1; j++)
{
dim *= ranges[j];
}
dim *= ranges[size-1]-1;
break;
}//case dtTabular
case dtGaussian:
{
PNL_THROW(CNotImplemented,"Gaussian")
break;
}//case dtGaussian
case dtCondGaussian:
{
PNL_THROW(CNotImplemented,"CondGaussian")
break;
}//case dtCondGaussian
default:
{
PNL_THROW(CBadConst,"distribution type")
break;
}
}//swith(param->GetFactorType)
break;
}//end case ftCPD
case ftPotential:
{
PNL_THROW(CNotImplemented,"Factor")
break;
}
default:
{
PNL_THROW(CBadConst,"FactorType")
break;
}
}//end switch(param->GetFactor)
dimOfModel += dim;
}//end for(i)
return dimOfModel;
}