openModeller  Version 1.5.0
GenericBestSubsets.cpp
Go to the documentation of this file.
1 
30 #include "GenericBestSubsets.hh"
31 
32 #include <openmodeller/om.hh>
33 #include <openmodeller/Random.hh>
34 #include <openmodeller/Sampler.hh>
35 
36 #include <stdlib.h>
37 #include <stdio.h>
38 #include <math.h>
39 
40 #define NUM_PARAM 8
41 
42 /************************************/
43 /*** Algorithm parameter metadata ***/
44 
46 {
47  // Best Subsets Parameters
48  {
49  "SubAlgorithm",
50  "SubAlgorithm",
51  "String",
52  "Name of the algorithm to use.",
53  "",
54  0,
55  0,
56  0,
57  0,
58  "DG_GARP"
59  },
60  {
61  "TrainingProportion", // Id.
62  "Training Proportion", // Name.
63  "Double", // Type.
64 
65  // Overview.
66  "Proportion of the occurrence data to be used to train the models.",
67 
68  // Description.
69  "",
70 
71  1, // Not zero if the parameter has lower limit.
72  0, // Parameter's lower limit.
73  1, // Not zero if the parameter has upper limit.
74  1, // Parameter's upper limit.
75  "0.5" // Parameter's typical (default) value.
76  },
77 
78  {
79  "TotalRuns", // Id.
80  "Total Runs", // Name.
81  "Integer", // Type.
82 
83  // Overview.
84  "Maximum number of GARP runs to be performed.",
85 
86  // Description.
87  "",
88 
89  1, // Not zero if the parameter has lower limit.
90  0, // Parameter's lower limit.
91  1, // Not zero if the parameter has upper limit.
92  10000, // Parameter's upper limit.
93  "10" // Parameter's typical (default) value.
94  },
95 
96  {
97  "HardOmissionThreshold", // Id.
98  "Hard Omission Threshold", // Name.
99  "Double", // Type.
100 
101  // Overview.
102  "Maximum acceptable omission error. Set to 100% to use only soft omission",
103 
104  // Description.
105  "",
106 
107  1, // Not zero if the parameter has lower limit.
108  0, // Parameter's lower limit.
109  1, // Not zero if the parameter has upper limit.
110  100, // Parameter's upper limit.
111  "100" // Parameter's typical (default) value.
112  },
113 
114  {
115  "ModelsUnderOmissionThreshold", // Id.
116  "Models Under Omission Threshold", // Name.
117  "Integer", // Type.
118 
119  // Overview.
120  "Minimum number of models below omission threshold.",
121 
122  // Description.
123  "",
124 
125  1, // Not zero if the parameter has lower limit.
126  0, // Parameter's lower limit.
127  1, // Not zero if the parameter has upper limit.
128  10000, // Parameter's upper limit.
129  "20" // Parameter's typical (default) value.
130  },
131 
132  {
133  "CommissionThreshold", // Id.
134  "Commission Threshold", // Name.
135  "Double", // Type.
136 
137  // Overview.
138  "Percentage of distribution of models to be taken regarding commission error.",
139 
140  // Description.
141  "",
142 
143  1, // Not zero if the parameter has lower limit.
144  0, // Parameter's lower limit.
145  1, // Not zero if the parameter has upper limit.
146  100, // Parameter's upper limit.
147  "50" // Parameter's typical (default) value.
148  },
149 
150  {
151  "CommissionSampleSize", // Id.
152  "Commission Sample Size", // Name.
153  "Integer", // Type.
154 
155  // Overview.
156  "Number of samples used to calculate commission error.",
157 
158  // Description.
159  "",
160 
161  1, // Not zero if the parameter has lower limit.
162  1, // Parameter's lower limit.
163  0, // Not zero if the parameter has upper limit.
164  0, // Parameter's upper limit.
165  "10000" // Parameter's typical (default) value.
166  },
167 
168  {
169  "MaxThreads", // Id.
170  "Maximum Number of Threads", // Name.
171  "Integer", // Type.
172 
173  // Overview.
174  "Maximum number of threads of executions to run simultaneously.",
175 
176  // Description.
177  "",
178 
179  1, // Not zero if the parameter has lower limit.
180  1, // Parameter's lower limit.
181  1, // Not zero if the parameter has upper limit.
182  1024, // Parameter's upper limit.
183  "1" // Parameter's typical (default) value.
184  }
185 };
186 
187 /************************************/
188 /*** Algorithm's general metadata ***/
189 
191 
192  "BestSubsets", // Id.
193  "Generic Best Subsets", // Name.
194  "3.0.1 alpha", // Version.
195 
196  // Overview.
197  "",
198 
199  // Description.
200  "",
201 
202  // Author
203  "",
204 
205  // Bibliography.
206  "",
207 
208  "Ricardo Scachetti Pereira", // Code author.
209  "rpereira [at] ku.edu", // Code author's contact.
210 
211  0, // Does not accept categorical data.
212  1, // Does not need (pseudo)absence points.
213 
214  NUM_PARAM, // Algorithm's parameters.
215  parameters_bs
216 };
217 
218 
219 /****************************************************************/
220 /****************** Algorithm's factory function ****************/
221 
222 OM_ALG_DLL_EXPORT
223 AlgorithmImpl *
225 {
226  return new GenericBestSubsets();
227 }
228 
229 OM_ALG_DLL_EXPORT
230 AlgMetadata const *
232 {
233  return &metadata_bs;
234 }
235 
236 /****************************************************************/
237 /****************** Garp class **********************************/
238 
240  : AbstractBestSubsets(& metadata_bs)
241 {
242 }
243 
244 // ****************************************************************
246 {
247 }
248 
AlgMetadata metadata_bs
#define NUM_PARAM
AlgParamMetadata parameters_bs[NUM_PARAM]
OM_ALG_DLL_EXPORT AlgMetadata const * algorithmMetadata()
OM_ALG_DLL_EXPORT AlgorithmImpl * algorithmFactory()