Utility module for cplint
- author
- - Fabrizio Riguzzi
- copyright
- - Fabrizio Riguzzi
- license
- - Artistic License 2.0 https://opensource.org/licenses/Artistic-2.0
- bar(+Probability:float, -Chart:dict) is det
- The predicate returns a dict for rendering with c3 as a bar chart with
a bar for the probability and a bar for one minus the probability.
- bar1(+Probability:float, -Chart:dict) is det
- The predicate returns a dict for rendering with c3 as a bar chart with
a bar for the probability
- bar(+Successes:int, +Failures:int, -Chart:dict) is det
- The predicate returns a dict for rendering with c3 as a bar chart with
a bar for the number of successes and a bar for the number of failures
- argbar(+Values:list, -Chart:dict) is det
- Values is a list of pairs V-N where
V is the value and N is the number of samples
returning that value.
The predicate returns a dict for rendering with c3 as a bar chart with
a bar for each value V.
The size of the bar is given by N.
- to_atom(+In:pair, -Out:pair) is det
- Given In=A0-N, to_atom/2 returns Out=A-N
where A is an atom representing A0
- histogram(+List:list, -Chart:dict) is det
- Equivalent to histogram/3 with an empty option list.
- histogram(+List:list, -Chart:dict, +Options:list) is det
- Draws a histogram of the samples in List. List must be a list of pairs of the form [V]-W or V-W
where V is a sampled value and W is its weight, or a list of values.
Options is a list of options, the following are recognised by histogram/3:
- min(+Min:float)
- the minimum value of domain, default value the minimum in List
- max(+Max:float)
- the maximum value of domain, default value the maximum in List
- nbins(+NBins:int)
- the number of bins for dividing the domain, default value 40
- densities(+PriorList:list, +PostList:list, -Chart:dict) is det
- Equivalent to densities/4 with an empty option list.
- densities(+PriorList:list, +PostList:list, -Chart:dict, +Options:list) is det
- Draws a line chart of the density of two sets of samples, usually
prior and post observations. The samples from the prior are in PriorList
while the samples from the posterior are in PostList.
PriorList and PostList must be lists of pairs of the form [V]-W or V-W
where V is a sampled value and W is its weight, or lists of values V.
Options is a list of options, the following are recognised by histogram/3:
- nbins(+NBins:int)
- the number of bins for dividing the domain, default value 40
*/
- density(+List:list, -Chart:dict) is det
- Equivalent to density/3 with an empty option list.
- density(+List:list, -Chart:dict, +Options:list) is det
- Draws a line chart of the density of a sets of samples.
The samples are in List
as pairs [V]-W or V-W where V is a value and W its weigth.
Options is a list of options, the following are recognised by density/3:
- min(+Min:float)
- the minimum value of domain, default value the minimum in List
- max(+Max:float)
- the maximum value of domain, default value the maximum in List
- nbins(+NBins:int)
- the number of bins for dividing the domain, default value 40
- density2d(+List:list, -Dens:list) is det
- Equivalent to density2d/3 with an empty option list.
- density2d(+List:list, -Dens:list, +Options:list) is det
- Returns a set of 3-dimensional points representing the plot of the
density of a sets of 2-dimensional samples.
The samples are in List
as pairs [X,Y]-W where (X,Y) is a point and W its weigth.
Options is a list of options, the following are recognised by density2d/3:
- xmin(+XMin:float)
- the minimum value of the X domain, default value the minimum in List
- xmax(-XMax:float)
- the maximum value of the X domain, default value the maximum in List
- ymin(-YMin:float)
- the minimum value of the Y domain, default value the minimum in List
- ymax(-YMax:float)
- the maximum value of the Y domain, default value the maximum in List
- nbins(+NBins:int)
- the number of bins for dividing the X and Y domains, default value 40
- to_pair(+Pair:pair, -FlattenedPair:pair) is det
- Given a pair E-W, returns a pair Ep-W where
Ep=EE if E=[EE], otherwise Ep=E
- key_pair(+Pair:pair, -Key:term) is det
- Given a pair Key-Vaule, returns its first element Key
- value_pair(+Pair:pair, -Value:term) is det
- Given a pair Key-Vaule, returns its second element Value
- bin(+N:int, +Values:list, +Lower:number, +BinWidth:number, -Couples:list) is det
- Given a list of numeric Values, a Lower value and BinWidth, returns in Couples
a list of N pairs V-Freq where V is the midpoint of a bin and Freq is the number
of values that are inside the bin interval [V-BinWidth/2,V+BinWidth/2)
starting with the bin where V-BinWidth/2=Lower
- beta(+Alphas:list, -Beta:float) is det
- Computes the value of the multivariate beta function for vector Alphas
https://en.wikipedia.org/wiki/Beta_function#Multivariate_beta_function
Alphas is a list of floats
- average(+Values:list, -Average:float) is det
- Computes the average of Values.
Values can be
- a list of numbers
- a list of pairs number-weight, in which case each number is multiplied by the weight
before being summed
- a list of lists, in which case lists are considered as matrices of numbers and averaged
element-wise
- a list of pairs list-weight, in which case the list is considered as a matrix of numbers.
The matrix in each element of List must have the same dimension and are aggregated element-
wise
- agg_val(+Couple:atom, +PartialSum:number, -Sum:number) is det
- Aggregate values by summation. The first argument is a couple _-N with
N the new value to sum to PartialSum
- variance(+Values:list, -Variance:float) is det
- Computes the variance of Values.
Values can be
- a list of numbers
- a list of pairs number-weight, in which case each number is multiplied by the weight
before being considered
- a list of pairs list-weight, in which case list is considered as a matrix of numbers.
The matrix in each element of List must have the same dimension and are aggregated element-
wise
- variance(+Values:list, -Average:float, -Variance:float) is det
- Computes the variance the average of Values.
Values can be
- a list of numbers
- a list of pairs number-weight, in which case each number is multiplied by the weight
before being considered
- a list of pairs list-weight, in which case list is considered as a matrix of numbers.
The matrix in each element of List must have the same dimension and are aggregated element-
wise
- std_dev(+Values:list, -Dev:float) is det
- Computes the standard deviation of Values.
Values can be
- a list of numbers
- a list of pairs number-weight, in which case each number is multiplied by the weight
before being considered
- a list of pairs list-weight, in which case list is considered as a matrix of numbers.
The matrix in each element of List must have the same dimension and are aggregated element-
wise
- std_dev(+Values:list, -Average:float, -Dev:float) is det
- Computes the standard deviation and the average of Values.
Values can be
- a list of numbers
- a list of pairs number-weight, in which case each number is multiplied by the weight
before being considered
- a list of pairs list-weight, in which case list is considered as a matrix of numbers.
The matrix in each element of List must have the same dimension and are aggregated element-
wise
- swi_builtin(+Goal:atom) is det
- Succeeds if Goal is an atom whose predicate is defined in Prolog
(either builtin or defined in a standard library).