phuzzy.shapes package¶
-
class
phuzzy.shapes.
FuzzyNumber
(**kwargs)[source]¶ Bases:
object
convex fuzzy number
-
__abs__
()[source]¶ apply abs operator to a fuzzy number
Parameters: other – phuzzy.FuzzyNumber Returns: fuzzy number
-
__add__
(other)[source]¶ adds a fuzzy number
Parameters: other – phuzzy.FuzzyNumber Returns: fuzzy number
-
__dict__
= dict_proxy({'cdf': <function cdf>, 'ppf': <function ppf>, 'get_shape': <function get_shape>, '__str__': <function __str__>, 'export_csv': <function export_csv>, '__rsub__': <function __rsub__>, '__rdiv__': <function __rdiv__>, '__rmul__': <function __rmul__>, '__lt__': <function __lt__>, '__weakref__': <attribute '__weakref__' of 'FuzzyNumber' objects>, 'make_convex': <function make_convex>, '__rpow__': <function __rpow__>, 'convert_df': <function convert_df>, 'get_01': <property object>, '_get_df': <function _get_df>, '__abs__': <function __abs__>, 'defuzzification_centroid2': <function defuzzification_centroid2>, 'from_data': <classmethod object>, '__doc__': 'convex fuzzy number', '__sub__': <function __sub__>, 'df': <property object>, '_set_df': <function _set_df>, 'defuzzification': <function defuzzification>, 'defuzzification_centroid': <function defuzzification_centroid>, 'from_results': <classmethod object>, '__pow__': <function __pow__>, '__gt__': <function __gt__>, 'copy': <function copy>, '__eq__': <function __eq__>, 'from_str': <classmethod object>, 'has_zero': <function has_zero>, 'defuzzification_alpha_one': <function defuzzification_alpha_one>, '__hash__': None, '_get_cls': <staticmethod object>, 'mean': <function mean>, 'discretize': <function discretize>, '__module__': 'phuzzy.shapes', '__radd__': <function __radd__>, 'rvs': <function rvs>, '__dict__': <attribute '__dict__' of 'FuzzyNumber' objects>, '__truediv__': <function __truediv__>, 'defuzzification_mean': <function defuzzification_mean>, '_get_number_of_alpha_levels': <function _get_number_of_alpha_levels>, '__init__': <function __init__>, 'alpha0': <property object>, 'alpha1': <property object>, '__contains__': <function __contains__>, '_disretize_range': <function _disretize_range>, 'defuzzification_p50': <function defuzzification_p50>, 'abs': <function abs>, '__neg__': <function __neg__>, '__ne__': <function __ne__>, 'get_alpha_from_value': <function get_alpha_from_value>, 'import_csv': <function import_csv>, 'max': <function max>, '_unify': <function _unify>, 'update': <function update>, '__add__': <function __add__>, 'pdf': <function pdf>, 'alpha': <function alpha>, 'min': <function min>, 'number_of_alpha_levels': <property object>, 'to_str': <function to_str>, '__div__': <function __truediv__>, '__mul__': <function __mul__>, 'get_01_str': <property object>, '__repr__': <function __repr__>, '_set_number_of_alpha_levels': <function _set_number_of_alpha_levels>})¶
-
__div__
(other)¶ divide by a fuzzy number
Parameters: other – phuzzy.FuzzyNumber Returns: fuzzy number
-
__hash__
= None¶
-
__module__
= 'phuzzy.shapes'¶
-
__mul__
(other)[source]¶ multiply with a fuzzy number
Parameters: other – phuzzy.FuzzyNumber Returns: fuzzy number
-
__neg__
()[source]¶ apply unary neg operator to a fuzzy number
Parameters: other – phuzzy.FuzzyNumber Returns: fuzzy number
-
__pow__
(other)[source]¶ apply power of a fuzzy number
Parameters: other – phuzzy.FuzzyNumber Returns: fuzzy number
-
__rpow__
(other)[source]¶ apply exponent of a fuzzy number
Parameters: other – phuzzy.FuzzyNumber Returns: fuzzy number
-
__sub__
(other)[source]¶ substract a fuzzy number
Parameters: other – phuzzy.FuzzyNumber Returns: fuzzy number
-
__truediv__
(other)[source]¶ divide by a fuzzy number
Parameters: other – phuzzy.FuzzyNumber Returns: fuzzy number
-
__weakref__
¶ list of weak references to the object (if defined)
-
alpha0
¶ row for alpha=0
-
alpha1
¶ row for alpha=1
-
cdf
(x, **kwargs)[source]¶ Cumulative distribution function
Parameters: - x – x values
- n – number of integration points
Returns: y
-
df
¶ number of alpha levels
-
discretize
(alpha0, alpha1, alpha_levels)[source]¶ discretize shape function
Parameters: - alpha0 – range at alpha=0
- alpha1 – range at alpha=1
- alpha_levels – number of alpha levels
Returns: None
-
export_csv
(filepath=None)[source]¶ export alpha levels to csv
Parameters: filepath – csv file path Returns:
-
classmethod
from_data
(**kwargs)[source]¶ instantiate fuzzy number from attributes
Parameters: kwargs – Return type: phuzzy.FuzzyNumber or derived object Returns: fuzzy number
-
classmethod
from_results
(df_res, name=None, number_of_alpha_levels=11)[source]¶ create FuzzyNumber from DataFrame(“alpha”, “res”)
Parameters: df – DataFrame with columns=[“alpha”, “res”] Returns: FuzzyNumber
-
get_01
¶ get alpha=0 and alpha=1 values
Returns: [[a0_l, a0_r], [a1_l, a1_r]]
-
get_01_str
¶ get alpha=0 and alpha=1 values
Returns: [[a0_l, a0_r], [a1_l, a1_r]]
-
get_alpha_from_value
(x)[source]¶ get alpha values from given x values
Parameters: x – x values Returns: alpha values
-
import_csv
(fh)[source]¶ load alpha levels from csv
Parameters: fh – csv file path or file handle Returns: alpha level dataframe
-
number_of_alpha_levels
¶ number of alpha levels
-
ppf
(x, **kwargs)[source]¶ Percent point function (inverse of cdf-percentiles).
Parameters: - x – x values
- n – number of integration points
Returns: y
-
-
class
phuzzy.shapes.
Trapezoid
(**kwargs)[source]¶ Bases:
phuzzy.shapes.FuzzyNumber
triange fuzzy number
-
__module__
= 'phuzzy.shapes'¶
-
cdf
(x, **kwargs)[source]¶ Cumulative distribution function
Parameters: - x – x values
- n – number of integration points
Returns: y
-
-
class
phuzzy.shapes.
Triangle
(**kwargs)[source]¶ Bases:
phuzzy.shapes.FuzzyNumber
triange fuzzy number
-
__module__
= 'phuzzy.shapes'¶
-
cdf
(x, **kwargs)[source]¶ Cumulative distribution function
Parameters: - x – x values
- n – number of integration points
Returns: y
-
discretize
(alpha0, alpha1, alpha_levels)[source]¶ discretize shape function
Parameters: - alpha0 – range at alpha=0
- alpha1 – range at alpha=1
- alpha_levels – number of alpha levels
Returns: None
-
-
class
phuzzy.shapes.
Uniform
(**kwargs)[source]¶ Bases:
phuzzy.shapes.FuzzyNumber
triange fuzzy number
-
__module__
= 'phuzzy.shapes'¶
-
cdf
(x, **kwargs)[source]¶ Cumulative distribution function
Parameters: - x – x values
- n – number of integration points
Returns: y
-