ARTICLE AD BOX
I tried to install mlpack differenty ways.
First I dont understand why I have to compile the lib as it's header-only.
As I already installed Armadillo (and it's was difficult), I thought it would be easier. Big mistake.
I tried many things. Using the find_mlpack() method provided in mlpack/Cmake/mlpack.cmake but it did not help.
The most promising way was just to use target_include_directories in cmake with the path to cereal, ensmallen, mlpack (to the include folder). It was strange because I was able to correctly #include them in my files, but when i tried to compile, some structures/modules/functions were not linked (see below)). I could eventually add the missing context manually, but some others began to appear, like a template structure that was apparently not a template, which was strange.
I also tried to use vcpkg to install everything (taken 20 minutes, reinstalled everything spanning from a fortran compiler, OpenMP, lapack, blas (even though i installed MKL for armadillo) to a lot of vcpgk things), but in the end I still had the same errors, ie some things were not recognised and inaccessible (coming from cereal especially) (see below).
One of the errors is
error C3861: 'CEREAL_NVP' : identificateur introuvable note: 'CEREAL_NVP' : la déclaration de fonction doit être disponible, car aucun des arguments ne dépend d'un paramètre de modèle. Le diagnostic s'est produit dans la fonction 'void mlpack::Layer<MatType>::serialize(Archive &,const uint32_t)' générée par le compilateur. le contexte d’instanciation du modèle (le plus ancien) est lors de la compilation du modèle de classe 'mlpack::Layer' (in english) : 'CEREAL_NVP': The function declaration must be available, because none of the arguments depend on a model parameter. The diagnosis occurred in the 'void mlpack::Layer<MatType>::serialize(Archive &,const uint32_t)' function generated by the compiler. the model instantiation context (oldest) is when compiling the class model 'mlpack::Layer'Or simply :
fatal error C1083: Impossible d'ouvrir le fichier include : 'cereal/archives/binary.hpp' : No such file or directory(This error can be solved by adding a include to this file, but I suspect this it not normal and thus it's not a good way of solving this issue)
extract of the code
#include <mlpack/methods/ann/layer/layer.hpp> #include <mlpack/methods/ann/loss_functions/mean_squared_error.hpp> #include <mlpack/methods/ann/init_rules/const_init.hpp> #include <mlpack/methods/ann/ffn.hpp> using namespace mlpack; using namespace arma; using namespace std; int main() { FFN<MeanSquaredError, ConstInitialization> model1(MeanSquaredError(), ConstInitialization(0.9)); // build layers - one linear layer and then the identity activation. model1.Add<Linear>(10, 1);// trainData.n_rows is the no. of variables in the regression /* code */ return 0; }(I use an example that I found online).
I also consider cloning the repository, but I'm afraid it won't work because the error seems to (mostly) stem from cereal.
I just want to use a neural network in C++ (using armadillo by preference) and all I found was infinite struggle. I might do it on my own, but it would not be flexible, and I could not easily change the algorithm I use.
What do you suggest?
