Skip to content

eTuDpy/phuzzy

 
 

Repository files navigation

phuzzy

GitPitch Codacy Badge Coverage Status Travis Dokumentation Status Updates saythanks.io/to/lepy DOI

  • python representation of fuzzy numbers|data
  • specify uncertainty easily

Usage

To use phuzzy in a project:

phuzzy.Triangle

p = phuzzy.Triangle(alpha0=[1,4], alpha1=[2], number_of_alpha_levels=5)

p.df

   alpha     l    r
0   0.00  1.00  4.0
1   0.25  1.25  3.5
2   0.50  1.50  3.0
3   0.75  1.75  2.5
4   1.00  2.00  2.0

phuzzy.Trapezoid

p = phuzzy.Trapezoid(alpha0=[1,4], alpha1=[2,3], number_of_alpha_levels=5)

p.df

   alpha     l     r
0   0.00  1.00  4.00
1   0.25  1.25  3.75
2   0.50  1.50  3.50
3   0.75  1.75  3.25
4   1.00  2.00  3.00

phuzzy.TruncNorm

p = phuzzy.TruncNorm(alpha0=[1,3], number_of_alpha_levels=15, name="x")

p.df

       alpha         l         r
0   0.000000  1.000000  3.000000
1   0.071429  1.234184  2.765816
2   0.142857  1.342402  2.657598
3   0.214286  1.414912  2.585088
4   0.285714  1.472370  2.527630
5   0.357143  1.521661  2.478339
6   0.428571  1.566075  2.433925
7   0.500000  1.607529  2.392471
8   0.571429  1.647354  2.352646
9   0.642857  1.686656  2.313344
10  0.714286  1.726558  2.273442
11  0.785714  1.768503  2.231497
12  0.857143  1.814923  2.185077
13  0.928571  1.871675  2.128325
14  1.000000  2.000000  2.000000

phuzzy.TruncGenNorm

import phuzzy.mpl as phm
tgn = phm.TruncGenNorm(alpha0=[1, 4], alpha1=[2, 3], number_of_alpha_levels=15, beta=3.)
tgn.plot(show=False, filepath="truncgennorm.png", title=True)

phuzzy.Superellipse

import phuzzy.mpl as phm
se = phm.Superellipse(alpha0=[-1, 2.], alpha1=None, m=1.0, n=.5, number_of_alpha_levels=17)
se.plot(show=True, filepath="superellipse.png", title=True)

Addition

x = phuzzy.Trapezoid(alpha0=[0, 4], alpha1=[2, 3], number_of_alpha_levels=5)
y = phuzzy.TruncNorm(alpha0=[1, 3], number_of_alpha_levels=15, name="y")
z = x + y
z.name = "x+y"

Substaction

x = phuzzy.Trapezoid(alpha0=[0, 4], alpha1=[2, 3], number_of_alpha_levels=5)
y = phuzzy.TruncNorm(alpha0=[1, 3], number_of_alpha_levels=15, name="y")
z = x - y
z.name = "x-y"

Multiplication

x = phuzzy.Trapezoid(alpha0=[0, 4], alpha1=[2, 3], number_of_alpha_levels=5)
y = phuzzy.TruncNorm(alpha0=[1, 3], number_of_alpha_levels=15, name="y")
z = x * y
z.name = "x*y"

Division

x = phuzzy.Trapezoid(alpha0=[0, 4], alpha1=[2, 3], number_of_alpha_levels=5)
y = phuzzy.TruncNorm(alpha0=[1, 3], number_of_alpha_levels=15, name="y")
z = x / y
z.name = "x/y"

Exponentiation

x = phuzzy.Trapezoid(alpha0=[0, 4], alpha1=[2, 3], number_of_alpha_levels=5)
y = phuzzy.TruncNorm(alpha0=[1, 3], number_of_alpha_levels=15, name="y")
z = x ** y
z.name = "x^y"

cite

plain

Ingolf Lepenies (2018): phuzzy - a python package for fuzzy data.
Zenodo. http://doi.org/10.5281/zenodo.1219616

bibtex

@article{phuzzy,
title={phuzzy - a python package for fuzzy data},
DOI={10.5281/zenodo.1219616},
publisher={Zenodo},
author={Ingolf Lepenies},
year={2018}}

"I can live with doubt and uncertainty! I think it's much more exciting to live not knowing than to have answers which might be wrong."

Richard Feynman

About

Fuzzy Python

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Jupyter Notebook 61.8%
  • Python 38.2%