Skip to content

Commit

Permalink
displayed wrong threshold/slope/intercept in fit warning
Browse files Browse the repository at this point in the history
  • Loading branch information
dariomalchiodi committed Dec 2, 2024
1 parent c0b2b2e commit 0b2cacc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion mulearn/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '1.1.1'
__version__ = '1.1.2'


import copy
Expand Down
17 changes: 11 additions & 6 deletions mulearn/fuzzifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ def r2_to_mu(r, threshold):
self.threshold_ = t_opt

if self.threshold_ < 0:
logger.warning("Profile fit returned a negative parameter")
logger.warning("Profile fit returned a negative parameter "
f"({self.threshold_})")
except RuntimeError:
# interpolation could not take place, fall back to fixed profile
self.profile = 'fixed'
Expand Down Expand Up @@ -321,9 +322,11 @@ def r2_to_mu(R_2, r_2_1, r_2_0):
raise ValueError("'profile' parameter should be equal to "
"'fixed' or 'infer' (provided value: {self.profile})")
if self.slope_ > 0:
logging.warning('Profile fitting returned a positive slope')
logging.warning('Profile fitting returned a positive slope '
f'({self.slope_})')
if self.intercept_ < 0:
logging.warning('Profile fitting returned a negative intercept')
logging.warning('Profile fitting returned a negative intercept '
f'({self.intercept_})')

return self

Expand Down Expand Up @@ -465,9 +468,11 @@ def r2_to_mu(R_2, r_2_1):
f"(provided value: {self.profile})")

if self.slope_ > 0:
logging.warning('Profile fitting returned a positive slope')
logging.warning('Profile fitting returned a positive slope '
f'({self.slope_})')
if self.intercept_ < 0:
logging.warning('Profile fitting returned a negative intercept')
logging.warning('Profile fitting returned a negative intercept '
f'({self.intercept_})')

return self

Expand Down Expand Up @@ -618,4 +623,4 @@ def get_membership(self, R_2):
if r_2 <= self.r_2_1_+self.max_\
else 0 for r_2 in R_2])



0 comments on commit 0b2cacc

Please sign in to comment.