def _tolerance(X, tol):
 if sp.issparse(X):
  variances = mean_variance_axis(X, axis=0)[1]
 else:
  variances = np.var(X, axis=0)
 return (np.mean(variances) * tol)

def _tolerance ( X , tol ) : if sp . issparse ( X ) : variances = mean_variance_axis ( X , axis = 0 ) [ 1 ] else : variances = np . var ( X , axis = 0 ) return ( np . mean ( variances ) * tol )
return a tolerance which is independent of the dataset .