pyuncertainnumber.characterisation.uncertainNumber

Attributes

Classes

UncertainNumber

Uncertain Number class

Functions

I(→ UncertainNumber)

a shortcut to construct the interval-type UN object

D(→ UncertainNumber)

a shortcut to construct the distribution-type UN object

DSS(→ UncertainNumber)

a shortcut for the Dempster-Shafer-type UN object

norm(*args)

gaussian(*args)

normal(*args)

alpha(*args)

anglit(*args)

argus(*args)

arcsine(*args)

beta(*args)

betaprime(*args)

bradford(*args)

burr(*args)

burr12(*args)

cauchy(*args)

chi(*args)

chi2(*args)

cosine(*args)

gamma(*args)

Module Contents

class pyuncertainnumber.characterisation.uncertainNumber.UncertainNumber(name=None, symbol=None, unit=None, uncertainty_type=None, essence=None, masses=None, intervals=None, distribution_parameters=None, pbox_parameters=None, hedge=None, _construct=None, nominal_value=1.0, p_flag=True, _skip_construct_init=False, measurand=None, nature=None, provenence=None, justification=None, structure=None, security=None, ensemble=None, variability=None, dependence=None, uncertainty=None, physical_quantity=None, _samples=None, **kwargs)

Uncertain Number class

Parameters:
  • intervals (-) – the interval specification for the UN object;

  • distribution_parameters (-) – a list of the distribution family and its parameters; e.g. [‘norm’, [0, 1]];

  • pbox_initialisation (-) – a list of the distribution family and its parameters; e.g. [‘norm’, ([0,1], [3,4])];

Example

Uncertain numbers can be constructed in multiple ways. For example, a canonical way allows users to fill in as many fields as possible:

>>> from pyuncertainnumber import UncertainNumber
>>> UncertainNumber(name="velocity", symbol="v", unit="m/s", intervals=[1, 2])
>>> UncertainNumber(name="velocity", symbol="v", unit="m/s", distribution_parameters=['normal', (10, 2)])
>>> UncertainNumber(name="velocity", symbol="v", unit="m/s", pbox_parameters=['normal', ([8, 12], [0.5, 1.5])])
>>> UncertainNumber(name="velocity", symbol="v", unit="m/s", essence='dempster_shafer', intervals=[[1,5], [3,6]], masses=[0.5, 0.5])

Alternatively, users can use shortcuts to quickly create UN objects and get on with calculations:

>>> import pyuncertainnumber as pun
>>> pun.I([1, 2])
>>> pun.D('gaussian', (10, 2))
>>> pun.normal([8, 12], [0.5, 1.5])
>>> pun.DSS(intervals=[[1,5], [3,6]], masses=[0.5, 0.5])
Q_
instances = []
name = None
symbol = None
uncertainty_type = None
essence = None
masses = None
intervals = None
distribution_parameters = None
pbox_parameters = None
hedge = None
_construct = None
nominal_value = 1.0
p_flag = True
_skip_construct_init = False
measurand = None
nature = None
provenence = None
justification = None
structure = None
security = None
ensemble = None
variability = None
dependence = None
uncertainty = None
_physical_quantity = None
_samples = None
property unit

get the physical quantity of the uncertain number

__init_check()
__init_construct()

the de facto parameterisation/instantiation procedure for the core constructs of the UN class

caveat:

user needs to by themselves figure out the correct shape of the ‘distribution_parameters’, such as [‘uniform’, [1,2]]

parameterised_pbox_specification()
_update_physical_quantity()
static match_pbox(keyword, parameters)

match the distribution keyword from the initialisation to create the underlying distribution object

Parameters:
  • keyword (-) – (str) the distribution keyword

  • parameters (-) – (list) the parameters of the distribution

init_check()

check if the UN initialisation specification is correct

Note

a lot of things to double check. keep an growing list: 1. unit 2. hedge: user cannot speficy both ‘hedge’ and ‘intervals’. ‘intervals’ takes precedence.

__str__()

string representation of the UncertainNumber

Note

the same as __reor__ for now until a better idea is proposed

__repr__() str

Concise __repr__

describe(style='verbose')

print out a verbose description of the uncertain number

ci()

get 95% range confidence interval

plot(**kwargs)

quick plot of the uncertain number object

display(**kwargs)

quick plot of the uncertain number object

property construct
property construct_type
property physical_quantity

get the physical quantity of the uncertain number

classmethod from_hedge(hedged_language)

create an Uncertain Number from hedged language

classmethod fromConstruct(construct)

create an Uncertain Number from a construct object

classmethod fromDistribution(D, **kwargs)

create an Uncertain Number from a Distribution object.

Parameters:
  • D (-) – a Distribution object

  • dist_family (str) – the distribution family

  • dist_params (list, tuple or string) – the distribution parameters

classmethod from_Interval(u)
classmethod from_pbox(p)

genenal from pbox

classmethod from_ds(ds)
classmethod from_sps(sps_dist)

create an UN object from a parametric scipy.stats dist object #! it seems that a function will suffice :param - sps_dist: scipy.stats dist object

Note

  • sps_dist –> UN.Distribution object

__array_ufunc__(ufunc, method, *inputs, **kwargs)
_apply(method)
sqrt()
exp()
tanh()
tan()
log()
sin()
cos()
reciprocal()
bin_ops(other, ops)
__add__(other)

add two uncertain numbers

__radd__(other)
__sub__(other)
__mul__(other)

multiply two uncertain numbers

__rmul__(other)
__truediv__(other)

divide two uncertain numbers

__rtruediv__(other)
__pow__(other)

power of two uncertain numbers

__rpow__(other)

power of two uncertain numbers

add(other, dependency='f')
sub(other, dependency='f')
mul(other, dependency='f')
div(other, dependency='f')
pow(other, dependency='f')
JSON_dump(filename='UN_data.json')

the JSON serialisation of the UN object into the filesystem

to_pbox()

convert the UN object to a pbox object

pyuncertainnumber.characterisation.uncertainNumber.I(*args: str | list[numbers.Number] | pyuncertainnumber.pba.intervals.number.Interval) UncertainNumber

a shortcut to construct the interval-type UN object

pyuncertainnumber.characterisation.uncertainNumber.D(*args, **kwargs) UncertainNumber

a shortcut to construct the distribution-type UN object

pyuncertainnumber.characterisation.uncertainNumber.DSS(*args, **kwargs) UncertainNumber

a shortcut for the Dempster-Shafer-type UN object

pyuncertainnumber.characterisation.uncertainNumber.norm(*args)
pyuncertainnumber.characterisation.uncertainNumber.gaussian(*args)
pyuncertainnumber.characterisation.uncertainNumber.normal(*args)
pyuncertainnumber.characterisation.uncertainNumber.alpha(*args)
pyuncertainnumber.characterisation.uncertainNumber.anglit(*args)
pyuncertainnumber.characterisation.uncertainNumber.argus(*args)
pyuncertainnumber.characterisation.uncertainNumber.arcsine(*args)
pyuncertainnumber.characterisation.uncertainNumber.beta(*args)
pyuncertainnumber.characterisation.uncertainNumber.betaprime(*args)
pyuncertainnumber.characterisation.uncertainNumber.bradford(*args)
pyuncertainnumber.characterisation.uncertainNumber.burr(*args)
pyuncertainnumber.characterisation.uncertainNumber.burr12(*args)
pyuncertainnumber.characterisation.uncertainNumber.cauchy(*args)
pyuncertainnumber.characterisation.uncertainNumber.chi(*args)
pyuncertainnumber.characterisation.uncertainNumber.chi2(*args)
pyuncertainnumber.characterisation.uncertainNumber.cosine(*args)
pyuncertainnumber.characterisation.uncertainNumber.gamma(*args)
pyuncertainnumber.characterisation.uncertainNumber.uniform
pyuncertainnumber.characterisation.uncertainNumber.lognormal