Package fuzzy :: Package complement :: Module Yager
[hide private]
[frames] | no frames]

Source Code for Module fuzzy.complement.Yager

 1  # -*- coding: utf-8 -*- 
 2  # 
 3  # Copyright (C) 2009  Rene Liebscher 
 4  # 
 5  # This program is free software; you can redistribute it and/or modify it under 
 6  # the terms of the GNU Lesser General Public License as published by the Free  
 7  # Software Foundation; either version 3 of the License, or (at your option) any 
 8  # later version. 
 9  # 
10  # This program is distributed in the hope that it will be useful, but WITHOUT  
11  # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
12  # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 
13  # details. 
14  #  
15  # You should have received a copy of the GNU Lesser General Public License 
16  # along with this program; if not, see <http://www.gnu.org/licenses/>.  
17  # 
18  """Complement after Yager""" 
19  __revision__ = "$Id: Yager.py,v 1.7 2010-03-28 18:39:02 rliebscher Exp $" 
20   
21  from fuzzy.complement.Parametric import Parametric 
22  from fuzzy.utils import inf_p 
23   
24 -class Yager(Parametric):
25 """Complement after Yager""" 26 27 _range = [ (0., inf_p) ] 28
29 - def __init__(self, omega=1., *args, **keywords):
30 """Initialize instance with given parameter 31 @param omega: The parameter 32 @type omega: float 33 """ 34 super(Yager, self).__init__(omega, *args, **keywords)
35
36 - def __call__(self, value):
37 """calculate the complement of the value 38 @param value: the value to complement 39 @type value: float 40 @return: the complemented value 41 @rtype: float 42 """ 43 return pow(1. - pow(float(value), self.p), 1. / self.p)
44
45 - def __repr__(self):
46 """Return representation of instance. 47 48 @return: representation of instance 49 @rtype: string 50 """ 51 return "%s.%s(omega=%s)" % (self.__class__.__module__, self.__class__.__name__, self.p)
52