Generated on Wed Apr 29 2015 11:51:40 for GGL-4.1.2 by doxygen 1.8.3.1
AP_NSPDK_Model.hh
Go to the documentation of this file.
1 
2 #ifndef GGL_CHEM_AP_NSPDK_MODEL_HH_
3 #define GGL_CHEM_AP_NSPDK_MODEL_HH_
4 
5 #include <string>
6 #include <map>
7 #include <set>
8 
9 #include <boost/shared_ptr.hpp>
10 
11 
12 // // set spirit closure limit if neccessary
13 //#if !defined(BOOST_SPIRIT_CLOSURE_LIMIT)
14 //#define BOOST_SPIRIT_CLOSURE_LIMIT 5
15 //#elif BOOST_SPIRIT_CLOSURE_LIMIT < 5
16 //#error "GGL_GRAPH_GML_GRAMMAR : BOOST_SPIRIT_CLOSURE_LIMIT too low, has to be at least 5"
17 //#endif
18 //
19 // // set phoenix limit if neccessary
20 //#if !defined(PHOENIX_LIMIT)
21 //#define PHOENIX_LIMIT 5
22 //#elif PHOENIX_LIMIT < 5
23 //#error "GGL_GRAPH_GML_GRAMMAR : PHOENIX_LIMIT too low, has to be at least 5"
24 //#endif
25 //
26 //#include <boost/version.hpp>
27 //#if BOOST_VERSION >= 103800
28 //#include <boost/spirit/include/qi.hpp>
29 //#include <boost/spirit/include/phoenix_core.hpp>
30 //#include <boost/spirit/include/classic.hpp>
31 //#include <boost/spirit/include/phoenix1.hpp>
32 //#include <boost/spirit/include/classic_actor.hpp>
33 //#define NS_BOOSTSPIRIT boost::spirit::classic
34 //#else
35 //#include <boost/spirit.hpp>
36 //#include <boost/spirit/phoenix.hpp>
37 //#include <boost/spirit/actor.hpp>
38 //#define NS_BOOSTSPIRIT boost::spirit
39 //#endif
40 
41 
42 #include "sgd/svmmodel.h"
43 
44 #include "nspdk/SVector.h"
45 
46 
47 namespace ggl {
48 namespace chem {
49 
50  /*! @brief NSPDK aromaticity model
51  *
52  * A linear SVM model derived using the NSPDK kernel that defines an
53  * aromaticity classifier used by ggl::chem::AP_NSPDK to identify
54  * aromatic rings.
55  *
56  * @author Martin Mann (c) 2011 http://www.bioinf.uni-freiburg.de/~mmann/
57  *
58  */
59  class AP_NSPDK_Model : public sgd::SvmModel {
60 
61  public:
62  //! construction
64  //! destruction
66 
67  //! the ID of the model
68  std::string modelID;
69 
70  //! a description of the model, e.g. its sources etc.
71  std::string description;
72 
73  //! whether or not the NSPDK features are ring centered or not
75 
76  /*!
77  * If ringCentered == true, this parameter defines up to what
78  * distance of ring nodes nodes are viewPoints, ie. a value of 0
79  * restricts the viewpoints to the ring only.
80  */
82 
83  //! the NSPDK distance parameter used to generate the model
85 
86  //! the NSPDK radius parameter used to generate the model
88 
89  //! the NSPDK parameter that defines the number of bits that
90  //! define the feature space size used to generate the model
92 
93  //! the maximal ring size considered when the model was created
94  size_t maxRingSize;
95 
96  //! the prefix added to all node label within all rings,
97  //! used to minimize the uncertain information for prediction
98  //! NOTE: the node label has to be set non-aromatic as well!
99  std::string ringNodeLabelPrefix;
100 
101  //! the edge label used within all rings,
102  //! used to minimize the uncertain information for prediction
103  std::string ringEdgeLabel;
104 
105  //! the label prefix that is added in front of each node and edge
106  //! label participating in the ring currently under consideration
107  std::string ringViewLabelPrefix;
108 
109  //! the weights for each feature
110  using sgd::SvmModel::w;
111 
112  //! the weight scale for better precision
113  using sgd::SvmModel::wscale;
114 
115  //! the bias that marks the treshold to reach to be classified as a
116  //! positive instance
117  using sgd::SvmModel::bias;
118 
119 
120  protected : // static members
121 
122  typedef boost::shared_ptr<AP_NSPDK_Model> AP_NSPDK_Model_Pointer;
123  //! container of all available predefined models
124  static std::map < std::string, AP_NSPDK_Model_Pointer > availableModels;
125  //! list of all available IDs of predefined models
126  static std::set < std::string > availableModelIDs;
127 
128  public: // static functions
129 
130  /*!
131  * Access to the predefined instances via their identifier.
132  *
133  * @param modelID the identifier of the model of interest
134  * @return the model or NULL if no model is available for the given
135  * identifier
136  */
137  static
138  const AP_NSPDK_Model * const
139  getInstance( const std::string & modelID );
140 
141  /*!
142  * Enables the access to all registered predefined model IDs that are
143  * handled via getInstance(modelID).
144  * @return the set of all available model IDs
145  */
146  static
147  const std::set < std::string > &
148  getAvailableModels( void );
149 
150  protected: // static model data
151 
152  //! the number of entries covered by the model "OpenBabel:2013"
154  //! the feature weight entries of the model "OpenBabel:2013"
155  static sgd::SVector::Pair OpenBabel_2013_wdata[];
156 
157  //! the number of entries covered by the model "Marvin:general:2013"
159  //! the feature weight entries of the model "Marvin:general:2013"
160  static sgd::SVector::Pair Marvin_general_2013_wdata[];
161 
162 
163  };
164 
165 
166 }} // namespace
167 
168 #endif /* GGL_CHEM_AP_NSPDK_MODEL_HH_ */