Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion cobra/evaluation/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import matplotlib.pyplot as plt
import seaborn as sns

# classification
from sklearn.metrics import precision_score
from sklearn.metrics import recall_score
from sklearn.metrics import f1_score
Expand All @@ -14,8 +15,14 @@
from sklearn.metrics import matthews_corrcoef
from sklearn.exceptions import NotFittedError

# regression
from sklearn.metrics import mean_absolute_error
from sklearn.metrics import mean_squared_error
from sklearn.metrics import r2_score

class Evaluator():


class classification_evaluator ():

"""Summary

Expand Down Expand Up @@ -515,3 +522,20 @@ def _compute_lift(y_true: np.ndarray, y_pred: np.ndarray,
lift = np.round(inc_in_top_n/avg_incidence, 2)[0]

return lift


class regression_evaluator ():
"""Summary

Attributes
----------
r2_score: float
computes the coefficient of determination, usually denoted as R²
Mean Absolute error: float
a risk metric corresponding to the expected value of the absolute error loss
Mean Squared Error: float
a risk metric corresponding to the expected value of the squared (quadratic) error
...


"""