updating docs

parent 3757771f
......@@ -2,6 +2,10 @@
"
pyAgrum.Arc is the representation of an arc between two nodes represented by `int`s : the head and the tail.
Available constructors:
`Arc(tail, head) -> Arc`
`Arc(src) -> Arc`
Parameters
----------
......@@ -9,12 +13,6 @@ tail : int
the tail
head : int
the head
A copy constructor is also available
Parameters
----------
src : :class: Arc
the Arc to copy
......
......@@ -2,14 +2,19 @@
"
BayesNet represents a Bayesian Network.
Available constructors:
`BayesNet(name='') -> BayesNet`
`BayesNet(source) -> BayesNet`
Parameters
==========
problem : :class:`~openturns.OptimizationProblem`
Optimization problem to solve.
tau : float
Multiplicative decrease of linear step.
omega : float
Armijo factor.
smooth : float
Growing factor in penalization term.
name: str
the name of the Bayes Net (optional)
source : :class:BayesNet
the Bayesian network to copy
"
%feature("docstring") gum::BayesNet::fastPrototype
""
%feature("docstring") gum::Edge
"
pyAgrum.Edge is the representation of an arc between two nodes represented by `int`s : the first and the second.
Available constructors :
`Edge(aN1,aN2) -> Edge`
`Edge(src) -> Edge`
Parameters
----------
aN1 : int
the nodeId of the first node
aN2 : int
the nodeId of the secondnode
src: Edge
the Edge to copy
"
%feature("docstring") gum::Edge::other
"
Parameters
----------
id : int
the nodeId of one of the nodes of the Edge
Returns
------
int
the nodeId of the other node
"
%feature("docstring") gum::Edge::first
"
Returns
------
int
the nodeId of the first node of the arc (the tail)
"
%feature("docstring") gum::Edge::second
"
Returns
------
int
the nodeId of the second node of the arc (the head)
"
%feature("docstring") gum::LabelizedVariable
"
LabelizedVariable is a discrete random variable with a customizable sequence of labels.
Available constructors:
`LabelizedVariable(aName, aDesc='', nbrLabel=2) -> LabelizedVariable`
`LabelizedVariable(aLDRV) -> LabelizedVariable`
Parameters
----------
aName: str
The name of the variable
aDesc: str
The (optional) description of the variable
nbrLabel: int
The number of labels to create. By default , the value start from '0' to 'nbrLabel-1'
aLDRV: pyAgrum.LabelizedVariable
Another `LabelizedVariable` that will be copied
Examples
--------
>>> import pyAgrum as gum
>>> v=gum.LabelizedVariable('v')
>>> print(v)
v<0,1>
>>> w=gum.LabelizedVariable('w','',4)
>>> print(w)
w<0,1,2,3>
"
......@@ -465,8 +465,72 @@ autodoc_default_flags = ['members',
#'undoc-members',
#'show-inheritance',
]
############################ TRANSLATER SWIG type #############
import re
gumReplaceList = [
('gum::Idx', 'int'),
('gum::Size', 'int'),
('gum::NodeId', 'int'),
('std::string', 'str'),
('gum::', 'pyAgrum.'),
('_double ', ' '),
('< double > *', ' '),
('< double >', ' '),
(' const ', ' '),
('std::', ''),
('const &', ' '),
('const *', ' '),
('\w+ self,', '')
]
dico = {re.escape(x): y for x, y in gumReplaceList}
pattern = re.compile('|'.join([re.escape(x) for x, _ in gumReplaceList]))
def substitution4swigautodoc(l):
if l is None:
return None
l1 = l
l2 = ""
while l1 != l2:
l2 = l1
l1 = pattern.sub(lambda m: dico[re.escape(m.group(0))], l1)
return l1
def process_docstring(app, what, name, obj, options, lines):
# loop through each line in the docstring and replace |class| with
# the classname
for i in range(len(lines)):
lines[i] = substitution4swigautodoc(lines[i])
def process_signature(app, what, name, obj, options, signature, return_annotation):
signature = substitution4swigautodoc(signature)
return_annotation = substitution4swigautodoc(return_annotation)
return signature, return_annotation
def skip(app, what, name, obj, skip, options):
exclusions = ('__weakref__', '__ne__', '__eq__', # special-members
'__doc__', '__module__', '__dict__', # undoc-members
'__swig_destroy__', # swig members
'clone', # special members
)
exclude = name in exclusions
if exclude:
print("####### {}.{} excluded ".format(obj,name))
return True
if skip:
return True
return None
autodoc_default_flags = ['members', 'private-members', 'special-members',
#'undoc-members','show-inheritance'
]
def setup(app):
pass
#app.connect('autodoc-process-docstring', process_docstring)
#app.connect('autodoc-process-signature', process_signature)
#app.connect("autodoc-skip-member", skip)
app.connect('autodoc-process-docstring', process_docstring)
app.connect('autodoc-process-signature', process_signature)
app.connect("autodoc-skip-member", skip)
/home/phw/Documents/gits/lip6/aGrUM-dev/wrappers/pyAgrum/doc/sphinx/bayesianNetwork.rst:27: WARNING: An option to autoclass is either unknown or has an invalid value: 'herited-members'
/home/phw/virtualenvs/devAgrum/lib/python3.5/site-packages/pyAgrum/pyAgrum.py:docstring of pyAgrum.Arc:1: WARNING: Inline interpreted text or phrase reference start-string without end-string.
/home/phw/virtualenvs/devAgrum/lib/python3.5/site-packages/pyAgrum/pyAgrum.py:docstring of pyAgrum.Edge:1: WARNING: Inline interpreted text or phrase reference start-string without end-string.
/home/phw/virtualenvs/devAgrum/lib/python3.5/site-packages/pyAgrum/pyAgrum.py:docstring of pyAgrum.pyAgrum.InfluenceDiagram_double:0: WARNING: duplicate object description of pyAgrum.pyAgrum.InfluenceDiagram_double, other instance in /home/phw/Documents/gits/lip6/aGrUM-dev/wrappers/pyAgrum/doc/sphinx/credalNetwork.rst, use :noindex: for one of them
/home/phw/virtualenvs/devAgrum/lib/python3.5/site-packages/pyAgrum/pyAgrum.py:docstring of pyAgrum.pyAgrum.InfluenceDiagram_double.__init__:0: WARNING: duplicate object description of pyAgrum.pyAgrum.InfluenceDiagram_double.__init__, other instance in /home/phw/Documents/gits/lip6/aGrUM-dev/wrappers/pyAgrum/doc/sphinx/credalNetwork.rst, use :noindex: for one of them
/home/phw/virtualenvs/devAgrum/lib/python3.5/site-packages/pyAgrum/pyAgrum.py:docstring of pyAgrum.pyAgrum.InfluenceDiagram_double.toDot:0: WARNING: duplicate object description of pyAgrum.pyAgrum.InfluenceDiagram_double.toDot, other instance in /home/phw/Documents/gits/lip6/aGrUM-dev/wrappers/pyAgrum/doc/sphinx/credalNetwork.rst, use :noindex: for one of them
/home/phw/virtualenvs/devAgrum/lib/python3.5/site-packages/pyAgrum/pyAgrum.py:docstring of pyAgrum.pyAgrum.InfluenceDiagram_double.__str__:0: WARNING: duplicate object description of pyAgrum.pyAgrum.InfluenceDiagram_double.__str__, other instance in /home/phw/Documents/gits/lip6/aGrUM-dev/wrappers/pyAgrum/doc/sphinx/credalNetwork.rst, use :noindex: for one of them
/home/phw/virtualenvs/devAgrum/lib/python3.5/site-packages/pyAgrum/pyAgrum.py:docstring of pyAgrum.pyAgrum.InfluenceDiagram_double.cpt:0: WARNING: duplicate object description of pyAgrum.pyAgrum.InfluenceDiagram_double.cpt, other instance in /home/phw/Documents/gits/lip6/aGrUM-dev/wrappers/pyAgrum/doc/sphinx/credalNetwork.rst, use :noindex: for one of them
/home/phw/virtualenvs/devAgrum/lib/python3.5/site-packages/pyAgrum/pyAgrum.py:docstring of pyAgrum.pyAgrum.InfluenceDiagram_double.utility:0: WARNING: duplicate object description of pyAgrum.pyAgrum.InfluenceDiagram_double.utility, other instance in /home/phw/Documents/gits/lip6/aGrUM-dev/wrappers/pyAgrum/doc/sphinx/credalNetwork.rst, use :noindex: for one of them
/home/phw/virtualenvs/devAgrum/lib/python3.5/site-packages/pyAgrum/pyAgrum.py:docstring of pyAgrum.pyAgrum.InfluenceDiagram_double.isUtilityNode:0: WARNING: duplicate object description of pyAgrum.pyAgrum.InfluenceDiagram_double.isUtilityNode, other instance in /home/phw/Documents/gits/lip6/aGrUM-dev/wrappers/pyAgrum/doc/sphinx/credalNetwork.rst, use :noindex: for one of them
......@@ -33,5 +36,7 @@
/home/phw/virtualenvs/devAgrum/lib/python3.5/site-packages/pyAgrum/pyAgrum.py:docstring of pyAgrum.pyAgrum.InfluenceDiagram_double.children:0: WARNING: duplicate object description of pyAgrum.pyAgrum.InfluenceDiagram_double.children, other instance in /home/phw/Documents/gits/lip6/aGrUM-dev/wrappers/pyAgrum/doc/sphinx/credalNetwork.rst, use :noindex: for one of them
/home/phw/virtualenvs/devAgrum/lib/python3.5/site-packages/pyAgrum/pyAgrum.py:docstring of pyAgrum.pyAgrum.InfluenceDiagram_double.loadBIFXML:0: WARNING: duplicate object description of pyAgrum.pyAgrum.InfluenceDiagram_double.loadBIFXML, other instance in /home/phw/Documents/gits/lip6/aGrUM-dev/wrappers/pyAgrum/doc/sphinx/credalNetwork.rst, use :noindex: for one of them
/home/phw/virtualenvs/devAgrum/lib/python3.5/site-packages/pyAgrum/pyAgrum.py:docstring of pyAgrum.pyAgrum.InfluenceDiagram_double.saveBIFXML:0: WARNING: duplicate object description of pyAgrum.pyAgrum.InfluenceDiagram_double.saveBIFXML, other instance in /home/phw/Documents/gits/lip6/aGrUM-dev/wrappers/pyAgrum/doc/sphinx/credalNetwork.rst, use :noindex: for one of them
/home/phw/virtualenvs/devAgrum/lib/python3.5/site-packages/pyAgrum/pyAgrum.py:docstring of pyAgrum.pyAgrum.InfluenceDiagram_double._s:0: WARNING: duplicate object description of pyAgrum.pyAgrum.InfluenceDiagram_double._s, other instance in /home/phw/Documents/gits/lip6/aGrUM-dev/wrappers/pyAgrum/doc/sphinx/credalNetwork.rst, use :noindex: for one of them
/home/phw/virtualenvs/devAgrum/lib/python3.5/site-packages/pyAgrum/lib/dynamicBN.py:docstring of pyAgrum.lib.dynamicBN._splitName:6: WARNING: Definition list ends without a blank line; unexpected unindent.
/home/phw/virtualenvs/devAgrum/lib/python3.5/site-packages/pyAgrum/lib/notebook.py:docstring of pyAgrum.lib.notebook.getInferenceEngine:4: WARNING: Field list ends without a blank line; unexpected unindent.
/home/phw/Documents/gits/lip6/aGrUM-dev/wrappers/pyAgrum/doc/sphinx/miscellaneous.rst:11: WARNING: error while formatting arguments for pyAgrum.randomDistribution: Forward reference must be an expression -- got 'std::vector< double,std::allocator< double > >'
/home/phw/Documents/gits/lip6/aGrUM-dev/wrappers/pyAgrum/doc/sphinx/miscellaneous.rst:11: WARNING: error while formatting arguments for pyAgrum.randomDistribution: Forward reference must be an expression -- got 'gum::Size'
%include "doc_Arc.i"
%include "doc_Edge.i"
%include "doc_BayesNet.i"
%include "doc_LabelizedVariable.i"
......@@ -3104,17 +3104,50 @@ class Arc(_object):
def other(self, id: 'gum::NodeId') -> "gum::NodeId":
"""other(self, id) -> gum::NodeId"""
"""
other(self, id) -> gum::NodeId
Parameters
----------
id : int
the nodeId of the head or the tail
Returns
------
int
the nodeId of the other node
"""
return _pyAgrum.Arc_other(self, id)
def first(self) -> "gum::NodeId":
"""first(self) -> gum::NodeId"""
"""
first(self) -> gum::NodeId
Returns
------
int
the nodeId of the first node of the arc (the tail)
"""
return _pyAgrum.Arc_first(self)
def second(self) -> "gum::NodeId":
"""second(self) -> gum::NodeId"""
"""
second(self) -> gum::NodeId
Returns
------
int
the nodeId of the second node of the arc (the head)
"""
return _pyAgrum.Arc_second(self)
......
......@@ -85959,9 +85959,42 @@ static PyMethodDef SwigMethods[] = {
" the id of the head node\n"
"\n"
""},
{ (char *)"Arc_other", _wrap_Arc_other, METH_VARARGS, (char *)"Arc_other(self, id) -> gum::NodeId"},
{ (char *)"Arc_first", _wrap_Arc_first, METH_VARARGS, (char *)"Arc_first(self) -> gum::NodeId"},
{ (char *)"Arc_second", _wrap_Arc_second, METH_VARARGS, (char *)"Arc_second(self) -> gum::NodeId"},
{ (char *)"Arc_other", _wrap_Arc_other, METH_VARARGS, (char *)"\n"
"Arc_other(self, id) -> gum::NodeId\n"
"\n"
"\n"
"Parameters\n"
"----------\n"
"id : int\n"
" the nodeId of the head or the tail\n"
"\n"
"\n"
"Returns\n"
"------\n"
"int\n"
" the nodeId of the other node\n"
"\n"
""},
{ (char *)"Arc_first", _wrap_Arc_first, METH_VARARGS, (char *)"\n"
"Arc_first(self) -> gum::NodeId\n"
"\n"
"\n"
"Returns\n"
"------\n"
"int\n"
" the nodeId of the first node of the arc (the tail)\n"
"\n"
""},
{ (char *)"Arc_second", _wrap_Arc_second, METH_VARARGS, (char *)"\n"
"Arc_second(self) -> gum::NodeId\n"
"\n"
"\n"
"Returns\n"
"------\n"
"int\n"
" the nodeId of the second node of the arc (the head)\n"
"\n"
""},
{ (char *)"Arc___eq__", _wrap_Arc___eq__, METH_VARARGS, (char *)"Arc___eq__(self, src) -> bool"},
{ (char *)"Arc___ne__", _wrap_Arc___ne__, METH_VARARGS, (char *)"Arc___ne__(self, src) -> bool"},
{ (char *)"Arc_swigregister", Arc_swigregister, METH_VARARGS, NULL},
......@@ -386,8 +386,8 @@ ADD_APPROXIMATIONSCHEME_API(gum::learning::genericBNLearner,gum::learning::BNLea
%template (IBayesNet_double ) gum::IBayesNet<double>;
%template ( BayesNet_double ) gum::BayesNet<double>;
%template ( BayesNetInference_double ) gum::BayesNetInference<double>;
%template ( BayesNetInference_double ) gum::BayesNetInference<double>;
%template ( LazyPropagation_double ) gum::LazyPropagation<double>;
%template ( ShaferShenoyInference_double ) gum::ShaferShenoyInference<double>;
%template ( VariableElimination_double ) gum::VariableElimination<double>;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment