Skip to content

Commit 9b5f379

Browse files
committed
rescale
1 parent 7adc5f9 commit 9b5f379

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/fuzzylogic/rules.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
"""Functions to evaluate, infer and defuzzify."""
22

3-
from .classes import Domain
4-
from .classes import Set
53
from math import isinf
64

5+
from .classes import Domain, Set
6+
7+
78
def round_partial(value, res):
89
"""
910
Round any value to any arbitrary precision.
@@ -57,8 +58,7 @@ def rescale(out_min, out_max, *, in_min=0, in_max=1):
5758
o = (b * c)
5859

5960
def f(x):
60-
y = (n - a * x - o + b * x) / e
61-
return y
61+
return (n - a * x - o + b * x) / m
6262

6363

6464
def weighted_sum(*, weights:dict, target_d:Domain) -> float:
@@ -79,4 +79,4 @@ def weighted_sum(*, weights:dict, target_d:Domain) -> float:
7979
def f(memberships):
8080
result = sum(r * weights[n] for n, r in memberships.items())
8181
return round_partial(rsc(result), target_d._res)
82-
return f
82+
return f

0 commit comments

Comments
 (0)