From c369591fe4a5a33501343add6d940723c8e708e8 Mon Sep 17 00:00:00 2001
From: Fabrizio Riguzzi
Date: Sun, 10 Dec 2023 21:14:53 +0100
Subject: [PATCH] new docs
---
docs/gen_pldoc.pl | 43 ++-
docs/pldoc/cplint_util.html | 169 ++++++++--
docs/pldoc/lemur.html | 544 +++++++++++++++++++++++---------
docs/pldoc/mcintyre.html | 343 ++++++++++++++++++--
docs/pldoc/pita.html | 602 ++++++++++++++++++++++++++++++------
docs/pldoc/slipcover.html | 288 +++++++++++++----
6 files changed, 1619 insertions(+), 370 deletions(-)
diff --git a/docs/gen_pldoc.pl b/docs/gen_pldoc.pl
index 3dacf40..2c2e416 100644
--- a/docs/gen_pldoc.pl
+++ b/docs/gen_pldoc.pl
@@ -1,20 +1,29 @@
-:- consult('../prolog/cplint_util').
-:- consult('../prolog/pita').
-:- consult('../prolog/mcintyre').
-:- consult('../prolog/slipcover').
-:- consult('../prolog/viterbi').
-:- consult('../prolog/kbest').
-:- consult('../prolog/pitaind').
-:- consult('../prolog/lemur').
+:- use_module(library(pldoc)).
+:- use_module(library(doc_files)).
+:- use_module(library(filesex)).
-:- doc_save('../prolog/pita.pl',[doc_root('./pldoc'),index_file(pita)]).
-:- doc_save('../prolog/mcintyre.pl',[doc_root('./pldoc'),index_file(mcintyre)]).
-:- doc_save('../prolog/slipcover.pl',[doc_root('./pldoc'),index_file(slipcover)]).
-:- doc_save('../prolog/viterbi.pl',[doc_root('./pldoc'),index_file(viterbi)]).
-:- doc_save('../prolog/cplint_util.pl',[doc_root('./pldoc'),index_file(cplint_util)]).
-:- doc_save('../prolog/kbest.pl',[doc_root('./pldoc'),index_file(kbest)]).
-:- doc_save('../prolog/pitaind.pl',[doc_root('./pldoc'),index_file(pitaind)]).
-:- doc_save('../prolog/lemur.pl',[doc_root('./pldoc'),index_file(lemur)]).
+:- initialization(gen_doc, main).
+doc_file(cplint_util).
+doc_file(pita).
+doc_file(mcintyre).
+doc_file(slipcover).
+doc_file(viterbi).
+doc_file(kbest).
+doc_file(pitaind).
+doc_file(lemur).
+load_all :-
+ ensure_loaded(library(clpr)),
+ forall(doc_file(File),
+ ( directory_file_path('../prolog', File, Path),
+ ensure_loaded(Path))).
-:- halt.
\ No newline at end of file
+gen_doc :-
+ load_all,
+ Opts = [ doc_root('./pldoc'),
+ include_reexported(true)
+ ],
+
+ forall(doc_file(File),
+ ( directory_file_path('../prolog', File, Path),
+ doc_save(Path, Opts))).
\ No newline at end of file
diff --git a/docs/pldoc/cplint_util.html b/docs/pldoc/cplint_util.html
index 133ba77..414e11e 100644
--- a/docs/pldoc/cplint_util.html
+++ b/docs/pldoc/cplint_util.html
@@ -24,38 +24,151 @@ cplint_util.pl -- cplint_util<
- 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
-Undocumented predicates
+
+- 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.
-The following predicates are exported, but not or incorrectly documented.
-
-
-- bar1(Arg1, Arg2)
-- agg_val(Arg1, Arg2, Arg3)
-- average(Arg1, Arg2)
-- value_pair(Arg1, Arg2)
-- density2d(Arg1, Arg2)
-- densities(Arg1, Arg2, Arg3)
-- bar(Arg1, Arg2, Arg3)
-- swi_builtin(Arg1)
-- to_atom(Arg1, Arg2)
-- key_pair(Arg1, Arg2)
-- density(Arg1, Arg2, Arg3)
-- histogram(Arg1, Arg2, Arg3)
-- histogram(Arg1, Arg2)
-- std_dev(Arg1, Arg2)
-- variance(Arg1, Arg2, Arg3)
-- beta(Arg1, Arg2)
-- to_pair(Arg1, Arg2)
-- density(Arg1, Arg2)
-- argbar(Arg1, Arg2)
-- std_dev(Arg1, Arg2, Arg3)
-- variance(Arg1, Arg2)
-- bin(Arg1, Arg2, Arg3, Arg4, Arg5)
-- density2d(Arg1, Arg2, Arg3)
-- densities(Arg1, Arg2, Arg3, Arg4)
+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 detGiven 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 detGiven a pair Key-Vaule, returns its first element Key
+ value_pair(+Pair:pair, -Value:term) is detGiven a pair Key-Vaule, returns its second element Value
+ bin(+N:int, +Values:list, +Lower:number, +BinWidth:number, -Couples:list) is detGiven 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 detComputes 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 detComputes 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 detAggregate 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 detComputes 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 detComputes 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 detComputes 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 detComputes 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 detSucceeds if Goal is an atom whose predicate is defined in Prolog
+(either builtin or defined in a standard library).