Skip to content

Commit 7adc5f9

Browse files
committed
rescale
1 parent 72022c2 commit 7adc5f9

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/fuzzylogic/rules.py

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

3+
from .classes import Domain
4+
from .classes import Set
35
from math import isinf
4-
from .classes import Domain, Set
56

67
def round_partial(value, res):
78
"""
@@ -51,11 +52,13 @@ def rescale(out_min, out_max, *, in_min=0, in_max=1):
5152
b = out_max
5253
c = in_min
5354
d = in_max
54-
55+
m = (d - c)
56+
n = (a * d)
57+
o = (b * c)
58+
5559
def f(x):
56-
y = (a*d - a*x - b*c + b*x) / (d - c)
60+
y = (n - a * x - o + b * x) / e
5761
return y
58-
return f
5962

6063

6164
def weighted_sum(*, weights:dict, target_d:Domain) -> float:

0 commit comments

Comments
 (0)