Skip to main content
https://img.shields.io/pypi/v/phuzzy.svg Documentation Status https://travis-ci.org/lepy/phuzzy.svg?branch=master https://coveralls.io/repos/github/lepy/phuzzy/badge.svg Updates https://api.codacy.com/project/badge/Grade/4814372e95c543a69c69004c853b17be https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg https://zenodo.org/badge/DOI/10.5281/zenodo.1219616.svg

PHUZZY

  • python representation of fuzzy numbers|data

  • specify uncertainty easily

Usage

To use phuzzy in a project:

# create a fuzzy number
p = phuzzy.Triangle(alpha0=[1,4], alpha1=[2],
                    number_of_alpha_levels=5)
# show alpha levels
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

Available shapes

Uniform

import phuzzy.mpl as phm
uni = phm.Uniform(alpha0=[1, 4], number_of_alpha_levels=5, name="x")
uni.plot(show=True, filepath="uniform.png", title=True)

Triangle

import phuzzy.mpl as phm

tri = phm.Triangle(alpha0=[1, 4], alpha1=[2], number_of_alpha_levels=5)
tri.plot(show=False, filepath="triangle.png", title=True)

Trapezoid

import phuzzy.mpl as phm
trap = phm.Trapezoid(alpha0=[1, 5], alpha1=[2, 3], number_of_alpha_levels=5)
trap.plot(show=False, filepath="trapezoid.png", title=True)

TruncNorm

import phuzzy.mpl as phm
tn = phm.TruncNorm(alpha0=[1, 3], number_of_alpha_levels=15, name="x")
tn.plot(show=False, filepath="truncnorm.png", title=True)

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)

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)

Basic operations

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"

Substraction

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"

Metadata

Release files for phuzzy 0.8.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for phuzzy 0.8.1
File Size Uploaded
phuzzy-0.8.1.tar.gz 2.6 MB Details

Release files / phuzzy-0.8.1.tar.gz

Download URL phuzzy-0.8.1.tar.gz
Size 2.6 MB
Tags Source
SHA-256 checksum
How to use checksums
8db89c799b483a5bb73e253daec7b81de3bb78d052f8c5502ce1609f4d4309e4
BLAKE2b-256 checksum
How to use checksums
1fd152295d436173907119bf1bf3e53902942f04485d0860db4cdb01cbdd771c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release history Release notifications | RSS feed

This release

0.8.1 This release

1 release file

0.8.0

1 release file

0.7.6

1 release file

0.7.5

1 release file

0.7.4

1 release file

0.7.3

1 release file

0.6.4

1 release file

0.6.2

1 release file

0.6.0

1 release file

0.5.14

1 release file

0.5.13

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page