pyuncertainnumber.characterisation.uncertainNumber ================================================== .. py:module:: pyuncertainnumber.characterisation.uncertainNumber Attributes ---------- .. autoapisummary:: pyuncertainnumber.characterisation.uncertainNumber.uniform pyuncertainnumber.characterisation.uncertainNumber.lognormal Classes ------- .. autoapisummary:: pyuncertainnumber.characterisation.uncertainNumber.UncertainNumber Functions --------- .. autoapisummary:: pyuncertainnumber.characterisation.uncertainNumber.I pyuncertainnumber.characterisation.uncertainNumber.D pyuncertainnumber.characterisation.uncertainNumber.DSS pyuncertainnumber.characterisation.uncertainNumber.norm pyuncertainnumber.characterisation.uncertainNumber.gaussian pyuncertainnumber.characterisation.uncertainNumber.normal pyuncertainnumber.characterisation.uncertainNumber.alpha pyuncertainnumber.characterisation.uncertainNumber.anglit pyuncertainnumber.characterisation.uncertainNumber.argus pyuncertainnumber.characterisation.uncertainNumber.arcsine pyuncertainnumber.characterisation.uncertainNumber.beta pyuncertainnumber.characterisation.uncertainNumber.betaprime pyuncertainnumber.characterisation.uncertainNumber.bradford pyuncertainnumber.characterisation.uncertainNumber.burr pyuncertainnumber.characterisation.uncertainNumber.burr12 pyuncertainnumber.characterisation.uncertainNumber.cauchy pyuncertainnumber.characterisation.uncertainNumber.chi pyuncertainnumber.characterisation.uncertainNumber.chi2 pyuncertainnumber.characterisation.uncertainNumber.cosine pyuncertainnumber.characterisation.uncertainNumber.gamma Module Contents --------------- .. py:class:: 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 :param - intervals: the interval specification for the UN object; :type - intervals: Interval :param - distribution_parameters: a list of the distribution family and its parameters; e.g. ['norm', [0, 1]]; :param - pbox_initialisation: a list of the distribution family and its parameters; e.g. ['norm', ([0,1], [3,4])]; .. rubric:: 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]) .. py:attribute:: Q_ .. py:attribute:: instances :value: [] .. py:attribute:: name :value: None .. py:attribute:: symbol :value: None .. py:attribute:: uncertainty_type :value: None .. py:attribute:: essence :value: None .. py:attribute:: masses :value: None .. py:attribute:: intervals :value: None .. py:attribute:: distribution_parameters :value: None .. py:attribute:: pbox_parameters :value: None .. py:attribute:: hedge :value: None .. py:attribute:: _construct :value: None .. py:attribute:: nominal_value :value: 1.0 .. py:attribute:: p_flag :value: True .. py:attribute:: _skip_construct_init :value: False .. py:attribute:: measurand :value: None .. py:attribute:: nature :value: None .. py:attribute:: provenence :value: None .. py:attribute:: justification :value: None .. py:attribute:: structure :value: None .. py:attribute:: security :value: None .. py:attribute:: ensemble :value: None .. py:attribute:: variability :value: None .. py:attribute:: dependence :value: None .. py:attribute:: uncertainty :value: None .. py:attribute:: _physical_quantity :value: None .. py:attribute:: _samples :value: None .. py:property:: unit get the physical quantity of the uncertain number .. py:method:: __init_check() .. py:method:: __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]] .. py:method:: parameterised_pbox_specification() .. py:method:: _update_physical_quantity() .. py:method:: match_pbox(keyword, parameters) :staticmethod: match the distribution keyword from the initialisation to create the underlying distribution object :param - keyword: (str) the distribution keyword :param - parameters: (list) the parameters of the distribution .. py:method:: 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. .. py:method:: __str__() string representation of the UncertainNumber .. note:: the same as __reor__ for now until a better idea is proposed .. py:method:: __repr__() -> str Concise __repr__ .. py:method:: describe(style='verbose') print out a verbose description of the uncertain number .. py:method:: ci() get 95% range confidence interval .. py:method:: plot(**kwargs) quick plot of the uncertain number object .. py:method:: display(**kwargs) quick plot of the uncertain number object .. py:property:: construct .. py:property:: construct_type .. py:property:: physical_quantity get the physical quantity of the uncertain number .. py:method:: from_hedge(hedged_language) :classmethod: create an Uncertain Number from hedged language .. py:method:: fromConstruct(construct) :classmethod: create an Uncertain Number from a construct object .. py:method:: fromDistribution(D, **kwargs) :classmethod: create an Uncertain Number from a Distribution object. :param - D: a Distribution object :type - D: Distribution :param dist_family: the distribution family :type dist_family: str :param dist_params: the distribution parameters :type dist_params: list, tuple or string .. py:method:: from_Interval(u) :classmethod: .. py:method:: from_pbox(p) :classmethod: genenal from pbox .. py:method:: from_ds(ds) :classmethod: .. py:method:: from_sps(sps_dist) :classmethod: 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 .. py:method:: __array_ufunc__(ufunc, method, *inputs, **kwargs) .. py:method:: _apply(method) .. py:method:: sqrt() .. py:method:: exp() .. py:method:: tanh() .. py:method:: tan() .. py:method:: log() .. py:method:: sin() .. py:method:: cos() .. py:method:: reciprocal() .. py:method:: bin_ops(other, ops) .. py:method:: __add__(other) add two uncertain numbers .. py:method:: __radd__(other) .. py:method:: __sub__(other) .. py:method:: __mul__(other) multiply two uncertain numbers .. py:method:: __rmul__(other) .. py:method:: __truediv__(other) divide two uncertain numbers .. py:method:: __rtruediv__(other) .. py:method:: __pow__(other) power of two uncertain numbers .. py:method:: __rpow__(other) power of two uncertain numbers .. py:method:: add(other, dependency='f') .. py:method:: sub(other, dependency='f') .. py:method:: mul(other, dependency='f') .. py:method:: div(other, dependency='f') .. py:method:: pow(other, dependency='f') .. py:method:: JSON_dump(filename='UN_data.json') the JSON serialisation of the UN object into the filesystem .. py:method:: to_pbox() convert the UN object to a pbox object .. py:function:: I(*args: str | list[numbers.Number] | pyuncertainnumber.pba.intervals.number.Interval) -> UncertainNumber a shortcut to construct the interval-type UN object .. py:function:: D(*args, **kwargs) -> UncertainNumber a shortcut to construct the distribution-type UN object .. py:function:: DSS(*args, **kwargs) -> UncertainNumber a shortcut for the Dempster-Shafer-type UN object .. py:function:: norm(*args) .. py:function:: gaussian(*args) .. py:function:: normal(*args) .. py:function:: alpha(*args) .. py:function:: anglit(*args) .. py:function:: argus(*args) .. py:function:: arcsine(*args) .. py:function:: beta(*args) .. py:function:: betaprime(*args) .. py:function:: bradford(*args) .. py:function:: burr(*args) .. py:function:: burr12(*args) .. py:function:: cauchy(*args) .. py:function:: chi(*args) .. py:function:: chi2(*args) .. py:function:: cosine(*args) .. py:function:: gamma(*args) .. py:data:: uniform .. py:data:: lognormal