for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
"""2D parabola."""
from hyperactive.base import BaseExperiment
class Parabola(BaseExperiment):
"""2D parabola.
Parameters
----------
a : float, default=1.0
Coefficient of the parabola.
b : float, default=0.0
c : float, default=0.0
"""
def __init__(self, a=1.0, b=0.0, c=0.0):
self.a = a
self.b = b
self.c = c
super().__init__()
def _paramnames(self):
return ["x", "y"]
def _score(self, params):
x = params["x"]
y = params["y"]
return self.a * (x**2 + y**2) + self.b * x + self.c * y, {}