question: private void calculateSphereSize ( double scale , KStarWrapper params ) { int i ; double sphereSize , minprob = 1.0 ; double pstar ; double pstarSum = 0.0 ; double pstarSquareSum = 0.0 ; double inc ; for ( i = 0 ; i < m_NumInstances ; i ++ ) { if ( m_Distances [ i ] < 0 ) { continue ; } else { pstar = PStar ( m_Distances [ i ] , scale ) ; if ( minprob > pstar ) { minprob = pstar ; } inc = pstar / m_ActualCount ; pstarSum += inc ; pstarSquareSum += inc * inc ; } } sphereSize = ( pstarSquareSum == 0 ? 0 : pstarSum * pstarSum / pstarSquareSum ) ; params . sphere = sphereSize ; params . avgProb = pstarSum ; params . minProb = minprob ; }
target:  Calculates the size of the "sphere of influence" defined as: sphere = sum(P)^2/sum(P^2) where P(i) = root*exp(-2*i*root). Since there are n different training instances we multiply P(i) by 1/n.