|
Lines 39-45
Link Here
|
| 39 |
#include <vigra/numpy_array.hxx> |
39 |
#include <vigra/numpy_array.hxx> |
| 40 |
#include <vigra/numpy_array_converters.hxx> |
40 |
#include <vigra/numpy_array_converters.hxx> |
| 41 |
#include <vigra/random_forest.hxx> |
41 |
#include <vigra/random_forest.hxx> |
|
|
42 |
#ifdef HasHDF5 |
| 42 |
#include <vigra/random_forest_hdf5_impex.hxx> |
43 |
#include <vigra/random_forest_hdf5_impex.hxx> |
|
|
44 |
#endif |
| 43 |
#include <set> |
45 |
#include <set> |
| 44 |
#include <cmath> |
46 |
#include <cmath> |
| 45 |
#include <memory> |
47 |
#include <memory> |
|
Lines 85-90
Link Here
|
| 85 |
return rf; |
87 |
return rf; |
| 86 |
} |
88 |
} |
| 87 |
|
89 |
|
|
|
90 |
#ifdef HasHDF5 |
| 88 |
template<class LabelType> |
91 |
template<class LabelType> |
| 89 |
RandomForest<LabelType> * |
92 |
RandomForest<LabelType> * |
| 90 |
pythonImportRandomForestFromHDF5(std::string filename, |
93 |
pythonImportRandomForestFromHDF5(std::string filename, |
|
Lines 96-102
Link Here
|
| 96 |
"RandomForest(): Unable to load from HDF5 file."); |
99 |
"RandomForest(): Unable to load from HDF5 file."); |
| 97 |
|
100 |
|
| 98 |
return rf.release(); |
101 |
return rf.release(); |
| 99 |
} |
102 |
} |
|
|
103 |
#endif |
| 100 |
|
104 |
|
| 101 |
template<class LabelType, class FeatureType> |
105 |
template<class LabelType, class FeatureType> |
| 102 |
python::tuple |
106 |
python::tuple |
|
Lines 248-259
Link Here
|
| 248 |
"'treeCount' controls the number of trees that are created.\n\n" |
252 |
"'treeCount' controls the number of trees that are created.\n\n" |
| 249 |
"See RandomForest_ and RandomForestOptions_ in the C++ documentation " |
253 |
"See RandomForest_ and RandomForestOptions_ in the C++ documentation " |
| 250 |
"for the meaning of the other parameters.\n") |
254 |
"for the meaning of the other parameters.\n") |
|
|
255 |
#ifdef HasHDF5 |
| 251 |
.def("__init__",python::make_constructor(&pythonImportRandomForestFromHDF5<UInt32>, |
256 |
.def("__init__",python::make_constructor(&pythonImportRandomForestFromHDF5<UInt32>, |
| 252 |
boost::python::default_call_policies(), |
257 |
boost::python::default_call_policies(), |
| 253 |
( arg("filename"), |
258 |
( arg("filename"), |
| 254 |
arg("pathInFile")="")), |
259 |
arg("pathInFile")="")), |
| 255 |
"Load from HDF5 file::\n\n" |
260 |
"Load from HDF5 file::\n\n" |
| 256 |
" RandomForest(filename, pathInFile)\n\n") |
261 |
" RandomForest(filename, pathInFile)\n\n") |
|
|
262 |
#endif |
| 257 |
.def("featureCount", |
263 |
.def("featureCount", |
| 258 |
&RandomForest<UInt32>::column_count, |
264 |
&RandomForest<UInt32>::column_count, |
| 259 |
"Returns the number of features the RandomForest works with.\n") |
265 |
"Returns the number of features the RandomForest works with.\n") |
|
Lines 299-309
Link Here
|
| 299 |
"Learn online.\n\n" |
305 |
"Learn online.\n\n" |
| 300 |
"Works only if forest has been created with prepare_online_learning=true. " |
306 |
"Works only if forest has been created with prepare_online_learning=true. " |
| 301 |
"Needs the old training data and the new appened, starting at startIndex.\n\n") |
307 |
"Needs the old training data and the new appened, starting at startIndex.\n\n") |
|
|
308 |
#ifdef HasHDF5 |
| 302 |
.def("writeHDF5", &rf_export_HDF5<UInt32>, |
309 |
.def("writeHDF5", &rf_export_HDF5<UInt32>, |
| 303 |
(arg("filename"), arg("pathInFile")="", arg("overwriteflag")=false), |
310 |
(arg("filename"), arg("pathInFile")="", arg("overwriteflag")=false), |
| 304 |
"Store the random forest in the given HDF5 file 'filname' under the internal\n" |
311 |
"Store the random forest in the given HDF5 file 'filname' under the internal\n" |
| 305 |
"path 'pathInFile'. If a dataset already exists, 'overwriteflag' determines\n" |
312 |
"path 'pathInFile'. If a dataset already exists, 'overwriteflag' determines\n" |
| 306 |
"if the old data are overwritten.\n") |
313 |
"if the old data are overwritten.\n") |
|
|
314 |
#endif |
| 307 |
; |
315 |
; |
| 308 |
} |
316 |
} |
| 309 |
|
317 |
|