Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@cache_latest
def loss(self, real=True):
# XXX: compute pending loss if real == False
losses = self._losses if self.tri is not None else dict()
return max(losses.values()) if losses else float("inf")
@cache_latest
def loss(self, real=True, *, n=None):
if n is None:
n = self.npoints if real else self.n_requested
else:
n = n
if n < 2:
return np.inf
standard_error = self.std / sqrt(n)
return max(
standard_error / self.atol, standard_error / abs(self.mean) / self.rtol
)
@cache_latest
def loss(self, real=True):
losses = self._losses(real)
return max(losses)
@cache_latest
def loss(self, real=True):
return abs(abs(self.igral) * self.tol - self.err)
@cache_latest
def loss(self, real=True):
losses = self.losses if real else self.losses_combined
if not losses:
return np.inf
max_interval, max_loss = losses.peekitem(0)
return max_loss
@cache_latest
def loss(self, real=True):
if not self.models:
return np.inf
else:
model = self.models[-1]
# Return the in-sample error (i.e. test the model
# with the training data). This is not the best
# estimator of loss, but it is the cheapest.
return 1 - model.score(self.Xi, self.yi)
@cache_latest
def loss(self, real=True):
if not self.bounds_are_done:
return np.inf
ip = self.interpolator(scaled=True) if real else self._interpolator_combined()
losses = self.loss_per_triangle(ip)
return losses.max()