aGrUM  0.14.2
structuralComparator.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Christophe GONZALES and Pierre-Henri WUILLEMIN *
3  * {prenom.nom}@lip6.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it wil be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
28 #ifndef GUM_LEARNING_STRUCTURAL_COMPARATOR_H
29 #define GUM_LEARNING_STRUCTURAL_COMPARATOR_H
30 
31 #include <agrum/BN/BayesNet.h>
32 #include <agrum/graphs/diGraph.h>
34 #include <agrum/graphs/undiGraph.h>
35 
36 
37 namespace gum {
38 
45  public:
46  // ##########################################################################
48  // ##########################################################################
50 
53 
56 
58 
59  // ##########################################################################
61  // ##########################################################################
64  void compare(const DiGraph& ref, const DiGraph& test);
66  void compare(const UndiGraph& ref, const UndiGraph& test);
68  void compare(const MixedGraph& ref, const MixedGraph& test);
70  template < typename GS1, typename GS2 >
71  void compare(const BayesNet< GS1 >& ref, const BayesNet< GS2 >& test);
73  template < typename GUM_SCALAR >
74  void compare(const BayesNet< GUM_SCALAR >& ref, const MixedGraph& test);
76  template < typename GUM_SCALAR >
77  void compare(const MixedGraph& ref, const BayesNet< GUM_SCALAR >& test);
78 
80  double precision_skeleton() const;
81  double recall_skeleton() const;
82  double f_score_skeleton() const;
83 
85  double precision() const;
86  double recall() const;
87  double f_score() const;
89 
90  protected:
91  private:
93  /* __________________________________________________
94  * | \predicted | | | |
95  * |true\ | --> | --- | X |
96  * |--------------|-----------|-----------|-----------|
97  * | --> | true arc |wrong edge |wrong none |
98  * | | mis. arc | arc | arc |
99  * |--------------|-----------|-----------|-----------|
100  * | --- |wrong arc | true edge |wrong none |
101  * | | edge | | edge |
102  * |--------------|-----------|-----------|-----------|
103  * | X |wrong arc |wrong edge | true none |
104  * | | none | none | |
105  * |______________|___________|___________|___________|
106  *
107  */
112  // double __precision, __recall, __f_score;
113  };
114 
115 } /* namespace gum */
116 
119 
120 #endif /* GUM_LEARNING_STRUCTURAL_COMPARATOR_H */
double f_score_skeleton() const
compare two DiGraphs
Class representing a Bayesian Network.
Definition: BayesNet.h:76
Base classes for oriented graphs.
double recall_skeleton() const
compare two DiGraphs
double f_score() const
compare two DiGraphs
Class representing Bayesian networks.
Base classes for undirected graphs.
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
double precision() const
Measures for the graphs.
double recall() const
compare two DiGraphs
A class for comparing graphs based on their structures.
Base class for all oriented graphs.
Definition: diGraph.h:108
StructuralComparator()
default constructor
void compare(const DiGraph &ref, const DiGraph &test)
compare two DiGraphs
double __true_edge
Confusion matrix.
double precision_skeleton() const
Measures for the skeleton, aka graph without orientations.
Base classes for mixed directed/undirected graphs.
Base class for undirected graphs.
Definition: undiGraph.h:106
~StructuralComparator()
destructor
Base class for mixed graphs.
Definition: mixedGraph.h:124