当前位置: 首页>>代码示例>>C++>>正文


C++ Coord::EuclideanDist方法代码示例

本文整理汇总了C++中Coord::EuclideanDist方法的典型用法代码示例。如果您正苦于以下问题:C++ Coord::EuclideanDist方法的具体用法?C++ Coord::EuclideanDist怎么用?C++ Coord::EuclideanDist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Coord的用法示例。


在下文中一共展示了Coord::EuclideanDist方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: returnVal

/*****************************************************************************************
 * vector< float > K_MeansPredict::PredictKey( const int PItype, const Coord< float >& Example, const float t_val )const
 *
 * Purpose: Find the key value and PI range of point P
 * Input:
 *	PI type: use cluster based PI's(0)/use global PI(1)
 *	Example: Example to predict
 *	t_val: T-test value for global PI (cluster based PI's not supported yet)
 * Output:
 *	Lower PI bound
 *	Prediction
 *	Upper Prediction bound
 *	(yes/no) is in prediction band
 *
 * 03.08.2006	djh	Replaced _totalUpper/_totalLowerConfBound with _totalBoundStub
 *			added t_val to parameter list
 *****************************************************************************************/
 vector< float > K_MeansPredict::PredictKey( const int PItype, const Coord< float >& Example, const float& t_val )const{
   vector< float > returnVal(4);
   // Find closest mean
   float minDist;
   int closestMean=0;
   for( int i=0; i< _means.size(); i++ )
   {
     float dist = Example.EuclideanDist( _means[i] );
     if( i==0 || dist<minDist)
     {
       minDist = dist;
       closestMean = i;
     }
   }
   returnVal[0] = float( KeySupport(closestMean) );
   if( PItype == 0 ){
     returnVal[1] = KeyMean(closestMean) - _upperConfBound[closestMean];
     returnVal[2] = KeyMean(closestMean) - _errMean[closestMean];
     returnVal[3] = KeyMean(closestMean) - _lowerConfBound[closestMean];
   }
   else{
     returnVal[1] = KeyMean(closestMean) - _totalErrMean - t_val*_totalBoundStub; //_totalUpperConfBound;
     returnVal[2] = KeyMean(closestMean) - _totalErrMean;
     returnVal[3] = KeyMean(closestMean) - _totalErrMean + t_val*_totalBoundStub; //_totalLowerConfBound;
   }
   return( returnVal );
 }
开发者ID:EISALab,项目名称:DBN,代码行数:44,代码来源:k_meanspredict.cpp

示例2: FindClusterIdx

/*****************************************************************************************
 * int K_MeansPredict::FindClusterIdx( const Coord< float >& P )const
 *
 * Purpose: Find the cluster that point P is in
 * Input:
 *	P: point
 * Output:
 *	cluster membership
 *****************************************************************************************/
 int K_MeansPredict::FindClusterIdx( const Coord< float >& P )const{
   float minDist;
   int closestMean=0;
   for( int i=0; i< _means.size(); i++ ){
     float dist = P.EuclideanDist( _means[i] );
     if( i==0 || dist<minDist){
       minDist = dist;
       closestMean = i;
     }
   }
   return( closestMean );
 }
开发者ID:EISALab,项目名称:DBN,代码行数:21,代码来源:k_meanspredict.cpp


注:本文中的Coord::EuclideanDist方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。