Skip to content

Commit

Permalink
Merge pull request #6636 from markotoplak/logloss-remove-eps
Browse files Browse the repository at this point in the history
Remove the eps argument from LogLoss
  • Loading branch information
janezd committed Nov 26, 2023
2 parents 23c3d07 + fc3d64d commit e3f215a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
15 changes: 13 additions & 2 deletions Orange/evaluation/scoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@
"""

import math
import warnings

import numpy as np
import sklearn.metrics as skl_metrics
from sklearn.metrics import confusion_matrix

from Orange.data import DiscreteVariable, ContinuousVariable, Domain
from Orange.misc.wrapper_meta import WrapperMeta
from Orange.util import OrangeDeprecationWarning


__all__ = ["CA", "Precision", "Recall", "F1", "PrecisionRecallFSupport", "AUC",
"MSE", "RMSE", "MAE", "MAPE", "R2", "LogLoss", "MatthewsCorrCoefficient"]
Expand Down Expand Up @@ -302,12 +305,20 @@ class LogLoss(ClassificationScore):
long_name = "Logistic loss"
default_visible = False

def compute_score(self, results, eps=1e-15, normalize=True,
def compute_score(self, results, eps="auto", normalize=True,
sample_weight=None):
if eps != "auto":
# eps argument will be removed in scikit-learn 1.5
warnings.warn(
(
"`LogLoss.compute_score`: eps parameter is unused. "
"It will always have value of `np.finfo(y_pred.dtype).eps`."
),
OrangeDeprecationWarning,
)
return np.fromiter(
(skl_metrics.log_loss(results.actual,
probabilities,
eps=eps,
normalize=normalize,
sample_weight=sample_weight)
for probabilities in results.probabilities),
Expand Down
4 changes: 4 additions & 0 deletions i18n/si.jaml
Original file line number Diff line number Diff line change
Expand Up @@ -2104,6 +2104,10 @@ evaluation/scoring.py:
class `LogLoss`:
LogLoss: Log Izguba
Logistic loss: Logisti膷na izguba
def `compute_score`:
auto: False
'`LogLoss.compute_score`: eps parameter is unused. ': False
It will always have value of `np.finfo(y_pred.dtype).eps`.: False
class `Specificity`:
Spec: true
Specificity: Specifi膷nost
Expand Down

0 comments on commit e3f215a

Please sign in to comment.