-
Notifications
You must be signed in to change notification settings - Fork 12
/
fitness_function.py
48 lines (34 loc) · 1.23 KB
/
fitness_function.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
__all__ = ["FitnessFunction"]
class FitnessFunction:
r"""Class for implementing fitness functions.
Date:
2020
Author:
Luka Pečnik
License:
MIT
Attributes:
Name (str): Name of the fitness function.
"""
Name = None
def __init__(self, **kwargs):
r"""Initialize fitness function."""
self.set_parameters(**kwargs)
def set_parameters(self, **kwargs):
r"""Set the parameters/arguments of the pipeline component."""
return
def get_fitness(self, predicted, expected):
r"""Return fitness value. The larger return value should represent a better fitness for the framework to work properly.
Arguments:
predicted (pandas.core.series.Series): Predicted values.
expected (pandas.core.series.Series): Expected values.
Returns:
float: Calculated fitness value.
"""
return None
def get_bounds(self):
"""Returns the optimization bounds for this fitness function.
The default is for classification metrics.
Retunrs:
Tuple[float, float]: lower and upper optimization bounds. Defaults to (0.0, 1.0)"""
return (0.0, 1.0)