cplint_r.pl -- cplint_r
This module contains predicates for drawing graphs with R in cplint on SWISH.
- author
- - Franco Masotti, Fabrizio Riguzzi
- copyright
- - Franco Masotti, Fabrizio Riguzzi
- license
- - Artistic License 2.0 https://opensource.org/licenses/Artistic-2.0
- build_xy_list(+X:list, +Y:list, -Out:list) is det
- Given two lists X and Y, builds an output list Out
in the form [X1-Y1,X2-Y2,...,XN-YN].
- r_row(+X:atom, +Y:atom, -Out:atom) is det
- Given two atoms X and Y, build the term
r(X,Y)
in Out.
- get_set_from_xy_list(+L:list, -R:list) is det
- Given an input list L in the form [X1-Y1,X2-Y2,...,XN-YN], transform it in
an output list R in the form [
r(X1,Y1)
,r(X2,Y2)
,...,r(XN,YN)
]. This means
that R will contain an X-Y relationship which can be then passed to an R
data frame.
- bar_r(+Probability:float) is nondet
- The predicate plots the probability
as a bar chart with a bar for Probability and
a bar for 1-Probability.
- bar_r(+Successes:int, +Failures:int) is nondet
- The predicate plots a chart with a bar for the number
of Successes and
a bar for the number of Failures.
- argbar_r(+Values:list) is det
- Values is a list of couples V-N where
V is the value and N is the number of samples
returning that value, or a list of values.
The predicate plots a bar chart
with a bar for each possible value V.
The size of the bar is given by N.
- histogram_r(+List:list, +Options:list) is det
- Draws a histogram of the samples in List.
List must be a list of couples of the form [V]-W or V-W
where V is a sampled value and W is its weight, or a list of
sampled 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
- density_r(+List:list) is det
- Display a smooth density estimate of a sets of samples.
The samples are in List
as couples V-W where V is a value and W its weigth.
- densities_r(+PriorList:list, +PostList:list) is det
- Display a smooth density estimate 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
as couples V-W where V is a value and W its weigth, or simply as
values V.
- compute_areas_diagrams_r(+LG:list, -AUCROC:float, -AUCPR:float) is det
- The predicate takes as input
a list LG of pairs probability-literal in asceding order on probability
where the literal can be an Atom (incading a positive example) or \+ Atom,
indicating a negative example while the probability is the probability of
Atom of being true.
The predicate returns
AUCROC: the size of the area under the ROC curve
AUCPR: the size of the area under the PR curve
PR and ROC diagrams are plotted.
See http://cplint.lamping.unife.it/example/exauc.pl for an example
- test_r(+P:probabilistic_program, +TestFolds:list_of_atoms, -LL:float, -AUCROC:float, -AUCPR:float) is det
- The predicate takes as input in P a probabilistic program,
tests P on the folds indicated in TestFolds and returns the
log likelihood of the test examples in LL, the area under the Receiver
Operating Characteristic curve in AUCROC, the area under the Precision Recall
curve in AUCPR and draws R diagrams of the curves.