Intel® oneAPI Data Analytics Library
Community support for building compute-intensive applications that run fast on Intel® architecture.
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

C++ ModelFileWriter and service.h are not found


Hello everyone!

I am currently trying to complete the following project: but I am having an issue and I have not been able to solve it in days now.

The problem is that I am trying to use the ModelFileWriter class but Visual Studio says it is undefined. At the moment, I am only including #include "daal.h" and obviously ModelFileWriter is not part of it.

I have done a little bit of research and it looks like I have to include "service.h", however, when I try to do that Visual Studio tells me that it cannot open the file. I know I am missing something, perhaps a library, but I do not know exactly what I am missing.

Can someone tell me if ModelFileWriter  is actually part of "service.h" and where I can find "services.h"?



0 Kudos
5 Replies

Hello Alessandro, 

service.h header file you may find out into daal_root\example\cpp\source\utils\ folder, but ModelFileWriter is not part of this header file. We will ask owner of this demo to share the source code if that will possible. we will check. Sorry for confusion. 




Hello Gennady,

Thank you very much for your assistance. It would be really helpful if the code can be shared. I am sure me and the community would highly appreciate it.





Hi Alessandro,

Attached please find model_file.h which is modified from the source file in daal_root\example\cpp\source\serialization\. The main file DigitsRec.cpp is also attached, which includes training and testing. The demo interface shown in the mentioned article was written in Python though. If you have any question, please let us know. Thanks!


Hello Shaojuan,

Thank you for uploading the files. That really helped my to move forward with the project but I am still running into some issues related to Intel DAAL. Currently, I am using VS 2017 with Intel DAAL 2018. The project files are the following:

Header Files: service.h, model_file.h, error_handling.h

Source Files: DigitsRec.cpp

Currently, when I am building the solution I get the following errors:Errors.PNG

Could anyone tell me what can cause this? Should I use Intel DAAL 2016 or maybe change these lines to something else?

Also, I noticed that this version of the code uses 4 files instead of 2 as shown in the code project website.

string trainDatasetFileName = "digits_tra.csv";
string trainGroundTruthFileName = "digits_tra_labels.csv";

string testDatasetFileName = "digits_tes.csv";
string testGroundTruthFileName = "digits_tes_labels.csv";

I am assuming I have to download these files from the UCI Repository but I am not entirely sure what the *labels.csv* files would be. Unfortunately, I have no clue what is inside of the "*.Z" files, yet. So, I am not sure which one has all of these files.

Thank you very much for your help! You all have been very helpful introducing me to Intel DAAL and I can't wait to complete the project.




Hello Everyone!

So, I finally got a chance to work on this project again and I've made some improvements since last time but it's still not enough.

I can finally build the solution without any errors but I haven't run it yet because I am unsure about which files I need to use from the repository. I am assuming that for trainDatasetFileName and testDatasetFileName I have to use the optdigits.tes and optdigits.tra since those are the only to files that truly look like .csv file files.

I took a look at all the files in the Repo and I am not sure if they are useful for this project.

The other thing that really confuses me more than anything else is where to locate the files for trainGroundTruthFileName and testGroundTruthFileName since I have no idea how they should look like. I mean, I know they are comma separeted values but in the Repo I only see 2 files as supposed to 4 (optdigits.tes and optdigits.tra).

Thanks to everyone who's been helping me so far!