Skip to content

Commit

Permalink
add defuzzification
Browse files Browse the repository at this point in the history
  • Loading branch information
lepy committed Nov 6, 2018
1 parent 0e73493 commit 9066f07
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions phuzzy/shapes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def discretize(self, alpha0, alpha1, alpha_levels):
def alpha(self, x):
"""get alpha from x"""
df = pd.concat([self.df[["l", "alpha"]].rename(columns={"l":"x"}), self.df[["alpha", "r"]].rename(columns={"r":"x"})]).sort_values(by=["x", "alpha"])
df = df.drop_duplicates()
return np.interp(x, df.x, df.alpha, left=0., right=0.)

def convert_df(self, alpha_levels=None, zero=0):
Expand Down

0 comments on commit 9066f07

Please sign in to comment.