本文整理汇总了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 );
}
示例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 );
}