Commit 69476614 by Gaspard Ducamp

[pyAgrum/Doc] several documentation added

parent d18070fd
Pipeline #13287189 passed with stage
in 1 minute 46 seconds
......@@ -127,7 +127,7 @@ bool
"
Parameters
----------
edge : Edge
edge : pyAgrum.Edge
the edge to be checked
clique1 : int
one extremity of the edge
......
......@@ -34,31 +34,9 @@ head : int
Warnings
--------
InvalidDirectedCircle raised if any (directed) cycle is created by this arc.
InvalidDirectedCircle raised if any (directed) cycle is created by this arc
Warnings
--------
InvalidNode raised if head or tail does not belong to the graph nodes.
"
%feature("docstring") gum::DAG::toDot
"
Returns
-------
str
a friendly display of the graph in DOT format
Examples
--------
>>> import pyAgrum as gum
>>> bn = gum.DAG()
>>> a = bn.addNode()
>>> b = bn.addNode()
>>> bn.addArc(a,b)
>>> bn.toDot()
DAG {
0;
1;
0 -> 1;
}
InvalidNode raised if head or tail does not belong to the graph nodes
"
\ No newline at end of file
......@@ -42,10 +42,14 @@ int
"
Add a node by choosing a new NodeId.
Returns
-------
int
the new NodeId
Parameters
----------
id : int
The id of the new node
Warnings
--------
DuplicateElement raised if the given id is already used
"
%feature("docstring") gum::DiGraph::arcs
......@@ -210,20 +214,6 @@ Returns
-------
str
a friendly display of the graph in DOT format
Examples
--------
>>> import pyAgrum as gum
>>> bn = gum.DiGraph()
>>> a = bn.addNode()
>>> b = bn.addNode()
>>> bn.addArc(a,b)
>>> bn.toDot()
digraph {
0;
1;
0 -> 1;
}
"
%feature("docstring") gum::DiGraph::topologicalOrder
......
%ignore gum::DisceteVariable::clone;
%feature("docstring") gum::DiscreteVariable
"
DiscreteVariable is the base class for discrete random variable.
Available constructors:
``DiscreteVariable(aName, aDesc='') -> DiscreteVariable``
``DiscreteVariable(aDRV) -> DiscreteVariable``
Parameters
----------
aName: str
The name of the variable
aDesc: str
The (optional) description of the variable
aDRV: pyAgrum.DiscreteVariable
Another `DiscreteVariable` that will be copied
"
%feature("docstring") gum::DiscreteVariable::clone
"
Returns
-------
pyAgrum.DiscreteVariable
a copy of the DiscreteVariable
"
%feature("docstring") gum::DiscreteVariable::domain
"
Returns
-------
str
the domain of the variable
"
%feature("docstring") gum::DiscreteVariable::domainSize
"
Returns
-------
int
the number of modalities in the variable domain
"
%feature("docstring") gum::DiscreteVariable::empty
"
Returns
-------
bool
True if the domain size < 2
"
%feature("docstring") gum::DiscreteVariable::index
"
Parameters
----------
str
a label
Returns
-------
int
the indice of the label
"
%feature("docstring") gum::DiscreteVariable::label
"
Parameters
----------
int
the index of the label we wish to return
Returns
-------
str
the indice-th label
Warnings
--------
OutOfBound raised if the variable does not contain the label
"
%feature("docstring") gum::DiscreteVariable::labels
"
Returns
-------
tuple
a tuple containing the labels
"
%feature("docstring") gum::DiscreteVariable::numerical
"
Parameters
----------
int
an index
Returns
-------
float
the numerical representation of the indice-th value
"
%feature("docstring") gum::DiscreteVariable::toDiscretizedVar
"
Returns
-------
pyAgrum.DiscretizedVariable
the discretized variable
Warnings
-------
RuntimeError raised if the variable is not a DiscretizedVariable
"
%feature("docstring") gum::DiscreteVariable::toLabelizedVar
"
Returns
-------
pyAgrum.LabelizedVariable
the labelized variable
Warnings
-------
RuntimeError raised if the variable is not a LabelizedVariable
"
%feature("docstring") gum::DiscreteVariable::toRangeVar
"
Returns
-------
pyAgrum.RangeVariable
the range variable
Warnings
-------
RuntimeError raised if the variable is not a RangeVariable
"
%feature("docstring") gum::DiscreteVariable::toStringWithDescription
"
Returns
-------
str
a description of the variable
"
%feature("docstring") gum::DiscreteVariable::varType
"
Warnings
-------
à faire
"
%ignore gum::DisceteVariable::clone;
%feature("docstring") gum::DiscretizedVariable
"
DiscretizedVariable is a discrete random variable with a set of ``ticks`` defining intervalls.
......@@ -20,12 +22,22 @@ aDDRV: pyAgrum.DiscretizedVariable
Examples
--------
>>> import pyAgrum as gum
>>> v=gum.DiscretizedVariable('v','a descr')
>>> print(v)
v<>
>>> v.addTick(1).addTick(3.14).addTick(0.4).addTick(0.2)
>>> print(w)
a<[0.2;0.4[,[0.4;1[,[1;3.14]>
>>>
>>> vX=gum.DiscretizedVariable('X','X has been discretized')
>>> vX.addTick(1).addTick(2).addTick(3).addTick(3.1415) #doctest: +ELLIPSIS
>>> ## <pyAgrum.pyAgrum.DiscretizedVariable;...>
>>> print(vX)
>>> ## X<[1;2[,[2;3[,[3;3.1415]>
>>>
>>> vX.isTick(4)
>>> ## False
>>>
>>> vX.labels()
>>> ## ('[1;2[', '[2;3[', '[3;3.1415]')
>>>
>>> # where is the real value 2.5 ?
>>> vX.index('2.5')
>>> ## 1
"
%feature("docstring") gum::DiscretizedVariable::domain
......@@ -35,3 +47,11 @@ Returns
str
the domain of the variable as a string
"
%feature("docstring") gum::DiscretizedVariable::clone
"
Returns
-------
pyAgrum.DiscretizedVariable
a copy of the DiscretizedVariable
"
......@@ -13,7 +13,7 @@ aN1 : int
the nodeId of the first node
aN2 : int
the nodeId of the secondnode
src: Edge
src: pyAgrum.Edge
the Edge to copy
"
......
%ignore gum::DisceteVariable::clone;
%feature("docstring") gum::LabelizedVariable
"
LabelizedVariable is a discrete random variable with a customizable sequence of labels.
......@@ -6,6 +8,8 @@ Available constructors:
``LabelizedVariable(aName, aDesc='', nbrLabel=2) -> LabelizedVariable``
``LabelizedVariable(aName, aDesc='') -> LabelizedVariable``
``LabelizedVariable(aLDRV) -> LabelizedVariable``
Parameters
......@@ -15,19 +19,39 @@ aName: str
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'
The number of labels to create (2 by default)
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>
>>>
>>> # creating a variable with 3 labels : '0', '1' and '2'
>>> va=gum.LabelizedVariable('a','a labelized variable',3)
>>> print(va)
>>> ## a<0,1,2>
>>>
>>> va.addLabel('foo')
>>> print(va)
>>> ## a<0,1,2,foo>
>>>
>>> va.chgLabel(1,'bar')
>>> print(va)
>>> a<0,bar,2,foo>
>>>
>>> vb=gum.LabelizedVariable('b','b',0).addLabel('A').addLabel('B').addLabel('C')
>>> print(vb)
>>> ## b<A,B,C>
>>>
>>> vb.labels()
>>> ## ('A', 'B', 'C')
>>>
>>> vb.isLabel('E')
>>> ## False
>>>
>>> vb.label(2)
>>> ## 'B'
"
......@@ -38,3 +62,11 @@ Returns
str
the domain of the variable as a string
"
%feature("docstring") gum::LabelizedVariable::clone
"
Returns
-------
pyAgrum.LabelizedVariable
a copy of the LabelizedVariable
"
\ No newline at end of file
%ignore gum::DisceteVariable::clone;
%feature("docstring") gum::RangeVariable
"
RangeVariable represents a variable with a range of integers as domain.
Available constructors:
``RangeVariable(aName, aDesc='',minVal, maxVal) -> RangeVariable``
``RangeVariable(aName, aDesc='',minVal) -> DiscreRangeVariableteVariable``
``RangeVariable(aName, aDesc='') -> RangeVariable``
``RangeVariable(aRV) -> RangeVariable``
Parameters
----------
aName: str
The name of the variable
aDesc: str
The (optional) description of the variable
minVal : int
The minimal integer of the interval
maxVal : int
The maximal integer of the interval
aDV: pyAgrum.RangeVariable
Another `RangeVariable` that will be copied
Examples
--------
>>> import pyAgrum as gum
>>>
>>> vI=gum.gum.RangeVariable('I','I in [4,10]',4,10)
>>> print(vI)
>>> ## I[4-10]
>>>
>>> vX.maxVal()
>>> ## 10
>>>
>>> vX.belongs(1)
>>> ## False
>>>
>>> # where is the value 5 ?
>>> vX.index('5')
>>> ## 1
>>>
>>> vi.labels()
>>> ## ('4', '5', '6', '7', '8', '9', '10')
"
%feature("docstring") gum::RangeVariable::clone
"
Returns
-------
pyAgrum.RangeVariable
a copy of the RangeVariable
"
\ No newline at end of file
......@@ -42,10 +42,14 @@ int
"
Add a node by choosing a new NodeId.
Returns
-------
int
the new NodeId
Parameters
----------
id : int
The id of the new node
Warnings
--------
DuplicateElement raised if the given id is already used
"
%feature("docstring") gum::UndiGraph::clear
......@@ -185,7 +189,7 @@ nodesSet : Set
Returns
-------
UndiGraph
pyAgrum.UndiGraph
The partial graph formed by the nodes given in parameter
"
......
%feature("docstring") gum::Variable::description
"
Returns
-------
str
the description of the variable
"
%feature("docstring") gum::Variable::name
"
Returns
-------
str
the name of the variable
"
%feature("docstring") gum::Variable::setDescription
"
set the description of the variable.
Parameters
----------
str
the new description of the variable
"
%feature("docstring") gum::Variable::setName
"
sets the name of the variable.
Parameters
----------
str
the new description of the variable
"
\ No newline at end of file
......@@ -522,10 +522,11 @@ def skip(app, what, name, obj, skip, options):
return True
return None
autodoc_default_flags = [#'members',
autodoc_default_flags = ['members',
#'private-members', 'special-members',
'inherited-members',
#'undoc-members','show-inheritance'
#'undoc-members',
#'show-inheritance'
]
def setup(app):
app.connect('autodoc-process-docstring', process_docstring)
......
......@@ -8,7 +8,6 @@ There are 3 types of discrete random variables in aGrUM/pyAgrum : LabelizedVaria
Common API for Random Discrete Variables
----------------------------------------
.. autoclass:: pyAgrum.DiscreteVariable
:members:
Concrete classes for Random Discrete Variables
----------------------------------------------
......@@ -17,7 +16,6 @@ LabelizedVariable
^^^^^^^^^^^^^^^^^
.. autoclass:: pyAgrum.LabelizedVariable
:members:
DiscretizedVariable
^^^^^^^^^^^^^^^^^^^
......@@ -25,10 +23,8 @@ DiscretizedVariable
.. autoclass:: pyAgrum.DiscretizedVariable
.. autoclass:: pyAgrum.pyAgrum.DiscretizedVariable_double
:members:
RangeVariable
^^^^^^^^^^^^^
.. autoclass:: pyAgrum.RangeVariable
:members:
%ignore gum::MixedGraph::addArc;
%ignore gum::MixedGraph::addEdge;
%ignore gum::MixedGraph::addNode;
%ignore gum::MixedGraph::addNodeWithId;
%ignore gum::MixedGraph::empty;
%ignore gum::MixedGraph::emptyArcs;
%ignore gum::MixedGraph::emptyEdges;
%ignore gum::MixedGraph::eraseArc;
%ignore gum::MixedGraph::eraseChildren;
%ignore gum::MixedGraph::eraseEdge;
%ignore gum::MixedGraph::eraseNeighbours;
%ignore gum::MixedGraph::eraseParents;
%ignore gum::MixedGraph::existsArc;
%ignore gum::MixedGraph::existsEdge;
%ignore gum::MixedGraph::existsNode;
%ignore gum::MixedGraph::size;
%ignore gum::MixedGraph::sizeArcs;
%ignore gum::MixedGraph::sizeEdges;
%feature("docstring") gum::MixedGraph
"
MixedGraph represents a Clique Graph.
Available constructors:
``MixedGraph() -> MixedGraph``
``MixedGraph(src) -> MixedGraph``
Parameters
----------
src : :class: MixedGraph
the MixedGraph to copy
"
%feature("docstring") gum::MixedGraph::mixedOrientedPath
"
Parameters
----------
node1 : int
the id form which the path begins
node2 : int
the id to witch the path ends
Returns
-------
List
a path from node1 to node2, using edges and/or arcs (following the direction of the arcs)
Warnings
--------
NotFound raised if no path can be found between the two nodes
"
%feature("docstring") gum::MixedGraph::mixedUnorientedPath
"
Parameters
----------
node1 : int
the id from which the path begins
node2 : int
the id to which the path ends
Returns
-------
List
a path from node1 to node2, using edges and/or arcs (not necessarily following the direction of the arcs)
Warnings
--------
NotFound raised if no path can be found between the two nodes
"
......@@ -6,7 +6,10 @@
%include "doc_CliqueGraph.i"
%include "doc_MixedGraph.i"
%include "doc_Variable.i"
%include "doc_DiscreteVariable.i"
%include "doc_LabelizedVariable.i"
%include "doc_DiscretizedVariable.i"
%include "doc_RangeVariable.i"
%include "doc_BayesNet.i"
......@@ -14,7 +14,6 @@
ADD_IDS_METHOD_TO_GRAPHCLASS(gum::DiGraph); // add for the sub-classes (including MixedGraph)
ADD_IDS_METHOD_TO_GRAPHCLASS(gum::UndiGraph);
%extend gum::DiGraph {
PyObject *arcs() { // add for the sub-classes (including MixedGraph)
PyObject* q=PyList_New(0);
......
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