SVM调用方法

网上各种方法搜索:svm的主体都是用标准的c/c++写的,一般给的libSVM的编译在控制台下进行,所以得到的是在类似DoS窗口下运行的程序,使用MFC应该只用做界面部分,把程序主体基本直接搬上去就行!不过如何在MFC中调用外部exe,并能出入参数,这的确是个问题啊,我调试了好久都没成功啊!纠结ing!

svm-scale.exe用来实现数据缩放归一化,svm-train.exe用来训练数据,生成向量机的model模型,svm-predict.exe用来预测.

Q: How to build a dynamic library (.dll file) on MS windows? 

The easiest way is to use Makefile.win. See details in README. Alternatively, you can use Visual C++. Here is the example using Visual Studio .Net 2008:

 

  1. Create a Win32 empty DLL project and set (in Project->$Project_Name Properties...->Configuration) to "Release." About how to create a new dynamic link library, please refer to http://msdn2.microsoft.com/en-us/library/ms235636(VS.80).aspx
  2. Add svm.cpp, svm.h to your project.
  3. Add __WIN32__ and _CRT_SECURE_NO_DEPRECATE to Preprocessor definitions (in Project->$Project_Name Properties...->C/C++->Preprocessor)
  4. Set Create/Use Precompiled Header to Not Using Precompiled Headers (in Project->$Project_Name Properties...->C/C++->Precompiled Headers)
  5. Set the path for the Modulation Definition File svm.def (in Project->$Project_Name Properties...->Linker->input
  6. Build the DLL.
  7. Rename the dll file to libsvm.dll and move it to the correct path.


posted @ 2011-09-21 22:09  hailong  阅读(1111)  评论(0编辑  收藏  举报