Skip to main content

fuzzy data

Project description

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"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

phuzzy-0.7.4.tar.gz (2.6 MB view details)

Uploaded Source

File details

Details for the file phuzzy-0.7.4.tar.gz.

File metadata

  • Download URL: phuzzy-0.7.4.tar.gz
  • Upload date:
  • Size: 2.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

File hashes

Hashes for phuzzy-0.7.4.tar.gz
Algorithm Hash digest
SHA256 07c605d5e3b289e10182b6a79f71a53d9be2d410bad7100a93f143b14b682c15
MD5 ecde0fa8a5c8e38eabab02d3ee6b339e
BLAKE2b-256 80fd9e86555352b3ee680de7e095f1ec2cf89a6e68f155d98b0bdcc2d69089ac

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page