1
0
Fork 0

Update README.rst

master
philipMartini 4 years ago committed by GitHub
parent e358f53ce9
commit 0da3dc20c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 47
      README.rst

@ -94,23 +94,25 @@ Parameters Estimation Example
Structure Estimation Examples Structure Estimation Examples
**************************** ****************************
This example shows how to estimate the structure given a series of trajectories using a constraint based approach. | This example shows how to estimate the structure given a series of trajectories using a constraint based approach.
The first three instructions import all the necessary data (trajectories, nodes cardinalities, nodes labels), | The first three instructions import all the necessary data (trajectories, nodes cardinalities, nodes labels),
and are contextual to the dataset that is been used, in the code comments are marked as optional <>. | and are contextual to the dataset that is been used, in the code comments are marked as optional <>.
If your data has a different structure or format you should implement your own importer (see Implementing your own importer example). | If your data has a different structure or format you should implement your own importer
The other instructions are not optional and should follow the same order. | (see Implementing your own importer example).
A SamplePath object is been created, passing an AbstractImporter object that contains the correct class members filled | The other instructions are not optional and should follow the same order.
with the data that are necessary to estimate the structure. | A SamplePath object is been created, passing an AbstractImporter object that contains the correct class members
Next the build_trajectories and build_structure methods are called to instantiate the objects that will contain | filled with the data that are necessary to estimate the structure.
the processed trajectories and all the net infos. | Next the build_trajectories and build_structure methods are called to instantiate the objects that will contain
Then an estimator object is created, in this case a constraint based estimator, it necessary to pass a SamplePath object | the processed trajectories and all the net information.
where build_trajectories and build_structure methods have already been called. | Then an estimator object is created, in this case a constraint based estimator,
If you have prior knowledge about the net structure pass it to the constructor with the known_edges parameter. | it necessary to pass a SamplePath object where build_trajectories and build_structure methods have already been called.
The other three parameters are contextual to the StructureConstraintBasedEstimator, see the documentation for more details. | If you have prior knowledge about the net structure pass it to the constructor with the known_edges parameter.
To estimate the structure simply call the estimate_structure method. | The other three parameters are contextual to the StructureConstraintBasedEstimator, see the documentation for more details.
You can obtain the estimated structure as a boolean adjacency matrix with the method adjacency_matrix, or save it as a json file | To estimate the structure simply call the estimate_structure method.
that contains all the nodes labels, and obviously the estimated edges. | You can obtain the estimated structure as a boolean adjacency matrix with the method adjacency_matrix,
You can also save a graphical model representation of the estimated structure with the save_plot_estimated_structure_graph. | or save it as a json file that contains all the nodes labels, and obviously the estimated edges.
| You can also save a graphical model representation of the estimated structure
| with the save_plot_estimated_structure_graph.
.. code-block:: python .. code-block:: python
@ -137,8 +139,9 @@ You can also save a graphical model representation of the estimated structure wi
s1.build_trajectories() s1.build_trajectories()
# build the information about the net # build the information about the net
s1.build_structure() s1.build_structure()
# construct a StructureEstimator object passing a correctly build SamplePath object and the # construct a StructureEstimator object passing a correctly build SamplePath object
# independence tests significance, if you have prior knowledge about the net structure create a list of tuples # and the independence tests significance, if you have prior knowledge about
# the net structure create a list of tuples
# that contains them and pass it as known_edges parameter # that contains them and pass it as known_edges parameter
se1 = StructureConstraintBasedEstimator(sample_path=s1, exp_test_alfa=0.1, chi_test_alfa=0.1, se1 = StructureConstraintBasedEstimator(sample_path=s1, exp_test_alfa=0.1, chi_test_alfa=0.1,
known_edges=[], thumb_threshold=25) known_edges=[], thumb_threshold=25)
@ -146,7 +149,9 @@ You can also save a graphical model representation of the estimated structure wi
se1.estimate_structure() se1.estimate_structure()
# obtain the adjacency matrix of the estimated structure # obtain the adjacency matrix of the estimated structure
print(se1.adjacency_matrix()) print(se1.adjacency_matrix())
# save the estimated structure to a json file (remember to specify the path AND the .json extension).... # save the estimated structure to a json file
# (remember to specify the path AND the .json extension)....
se1.save_results('./results0.json') se1.save_results('./results0.json')
# ...or save it also in a graphical model fashion (remember to specify the path AND the .png extension) # ...or save it also in a graphical model fashion
# (remember to specify the path AND the .png extension)
se1.save_plot_estimated_structure_graph('./result0.png') se1.save_plot_estimated_structure_graph('./result0.png')