load.hpp
Go to the documentation of this file.
1 
14 #ifndef MLPACK_CORE_DATA_LOAD_HPP
15 #define MLPACK_CORE_DATA_LOAD_HPP
16 
17 #include <mlpack/prereqs.hpp>
18 #include <mlpack/core/util/log.hpp>
19 #include <string>
20 
21 #include "format.hpp"
22 #include "dataset_mapper.hpp"
23 #include "image_info.hpp"
24 #include "load_csv.hpp"
25 #include "load_arff.hpp"
26 #include "detect_file_type.hpp"
27 
28 namespace mlpack {
29 namespace data {
30 
72 template<typename eT>
73 bool Load(const std::string& filename,
74  arma::Mat<eT>& matrix,
75  const bool fatal = false,
76  const bool transpose = true,
77  const FileType inputLoadType = FileType::AutoDetect);
78 
108 template<typename eT>
109 bool Load(const std::string& filename,
110  arma::SpMat<eT>& matrix,
111  const bool fatal = false,
112  const bool transpose = true);
113 
141 template<typename eT>
142 bool Load(const std::string& filename,
143  arma::Col<eT>& vec,
144  const bool fatal = false);
145 
173 template<typename eT>
174 bool Load(const std::string& filename,
175  arma::Row<eT>& rowvec,
176  const bool fatal = false);
177 
214 template<typename eT, typename PolicyType>
215 bool Load(const std::string& filename,
216  arma::Mat<eT>& matrix,
217  DatasetMapper<PolicyType>& info,
218  const bool fatal = false,
219  const bool transpose = true);
220 
246 template<typename T>
247 bool Load(const std::string& filename,
248  const std::string& name,
249  T& t,
250  const bool fatal = false,
252 
266 template<typename eT>
267 bool Load(const std::string& filename,
268  arma::Mat<eT>& matrix,
269  ImageInfo& info,
270  const bool fatal = false);
271 
281 template<typename eT>
282 bool Load(const std::vector<std::string>& files,
283  arma::Mat<eT>& matrix,
284  ImageInfo& info,
285  const bool fatal = false);
286 
287 // Implementation found in load_image.cpp.
288 bool LoadImage(const std::string& filename,
289  arma::Mat<unsigned char>& matrix,
290  ImageInfo& info,
291  const bool fatal = false);
292 
293 } // namespace data
294 } // namespace mlpack
295 
296 // Include implementation of Load() for matrix.
297 #include "load_impl.hpp"
298 // Include implementation of model-loading Load() overload.
299 #include "load_model_impl.hpp"
300 // Include implementation of Load() for vectors.
301 #include "load_vec_impl.hpp"
302 // Include implementation of Load() for images.
303 #include "load_image_impl.hpp"
304 
305 #endif
Linear algebra utility functions, generally performed on matrices or vectors.
format
Define the formats we can read through cereal.
Definition: format.hpp:20
The core includes that mlpack expects; standard C++ includes and Armadillo.
bool LoadImage(const std::string &filename, arma::Mat< unsigned char > &matrix, ImageInfo &info, const bool fatal=false)
bool Load(const std::string &filename, arma::Mat< eT > &matrix, const bool fatal=false, const bool transpose=true, const FileType inputLoadType=FileType::AutoDetect)
Loads a matrix from file, guessing the filetype from the extension.
constexpr auto data(Container const &container) noexcept -> decltype(container.data())
Definition: iterator.hpp:79
attempt to automatically detect the file type