def compute_variance(self, error_sqr_dists=None):
'''
Compute the variance of the errors to the model.
# Parameters
error_sqr_dists : list of float
A vector holding the distances
# Returns
variance : double
'''
if error_sqr_dists is None:
if len(self._error_sqr_dists) == 0:
raise ValueError('The variance of the Sample Consensus model distances cannot \
be estimated, as the model has not been computed yet. Please compute the model \
first or at least run selectWithinDistance before continuing.')
error_sqr_dists = self._error_sqr_dists
medidx = int(len(error_sqr_dists) / 2)
return 2.1981 * np.partition(error_sqr_dists, medidx)[medidx]
评论列表
文章目录