如何在LIBSVM中保存MATLAB训练的模型
How to save matlab trained model in libsvm
我是libsvm和matlab的新手。我已经从网站下载了LIBSVM 3.17,并使用MATLAB培训了我的数据集。我想保存文件,然后使用了SVM_SAVEMODEL.C,该文件拒绝在MATLAB中编译。这是我收到的信息
mex svm_savemodel.c
Creating library C:UsersmarkAppDataLocalTempmex_zcr67jtemplib.x and object C:UsersmarkAppDataLocalTempmex_zcr67jtemplib.exp
svm_savemodel.obj : error LNK2019: unresolved external symbol _svm_free_and_destroy_model referenced in function _mexFunction
svm_savemodel.obj : error LNK2019: unresolved external symbol _svm_save_model referenced in function _mexFunction
svm_savemodel.obj : error LNK2019: unresolved external symbol _matlab_matrix_to_model referenced in function _mexFunction
svm_savemodel.mexw32 : fatal error LNK1120: 3 unresolved externals
C:PROGRA~1MATLABR2011BBINMEX.PL: Error: Link of 'svm_savemodel.mexw32' failed.
Error using mex (line 206)
Unable to complete successfully.
那么谁能帮助我解决这个问题?我包括svm.h,mex.h,svm_model_matlab.h,但它拒绝了....
这就是我所做的
>> mex -setup
Welcome to mex -setup. This utility will help you set up
a default compiler. For a list of supported compilers, see
http://www.mathworks.com/support/compilers/R2011b/win32.html
Please choose your compiler for building MEX-files:
Would you like mex to locate installed compilers [y]/n? y
Select a compiler:
[1] Lcc-win32 C 2.4.1 in C:PROGRA~1MATLABR2011bsyslcc
[2] Microsoft Visual C++ 2010 in C:Program FilesMicrosoft Visual Studio 10.0
[0] None
Compiler: 2
Please verify your choices:
Compiler: Microsoft Visual C++ 2010
Location: C:Program FilesMicrosoft Visual Studio 10.0
Are these correct [y]/n? y
***************************************************************************
Warning: MEX-files generated using Microsoft Visual C++ 2010 require
that Microsoft Visual Studio 2010 run-time libraries be
available on the computer they are run on.
If you plan to redistribute your MEX-files to other MATLAB
users, be sure that they have the run-time libraries.
***************************************************************************
Trying to update options file: C:UsersmichaelAppDataRoamingMathWorksMATLABR2011bmexopts.bat
From template: C:PROGRA~1MATLABR2011bbinwin32mexoptsmsvc100opts.bat
Done . . .
**************************************************************************
Warning: The MATLAB C and Fortran API has changed to support MATLAB
variables with more than 2^32-1 elements. In the near future
you will be required to update your code to utilize the new
API. You can find more information about this at:
http://www.mathworks.com/support/solutions/en/data/1-5C27B9/?solution=1-5C27B9
Building with the -largeArrayDims option enables the new API.
**************************************************************************
>> cd('C:libsvm-3.17libsvm-3.17matlab');
>> make
>> mex svm_savemodel.c
Creating library C:UsersmichaelAppDataLocalTempmex_coX2K1templib.x and object C:UsersmichaelAppDataLocalTempmex_coX2K1templib.exp
svm_savemodel.obj : error LNK2019: unresolved external symbol _svm_free_and_destroy_model referenced in function _mexFunction
svm_savemodel.obj : error LNK2019: unresolved external symbol _svm_save_model referenced in function _mexFunction
svm_savemodel.obj : error LNK2019: unresolved external symbol _matlab_matrix_to_model referenced in function _mexFunction
svm_savemodel.mexw32 : fatal error LNK1120: 3 unresolved externals
C:PROGRA~1MATLABR2011BBINMEX.PL: Error: Link of 'svm_savemodel.mexw32' failed.
Error using mex (line 206)
Unable to complete successfully.
>>
将其添加到您的make.m
文件(您可以将它们添加到if
和else
Part):
mex CFLAGS="$CFLAGS -std=c99" -largeArrayDims svm_savemodel.c ../svm.cpp svm_model_matlab.c
相关文章:
- 在C++STL中是否有Polyval(Matlab函数)等价物?
- 有可能在Armadillo中复制MATLAB circshift方法吗
- QTableView:endMoveRows在模型中重置水平页眉大小
- 将IBM Rhapsody模型集成到VS 2019中
- 使用 MATLAB 编码器生成C++代码:编译错误"undefined reference to `rgb2gray_tbb_real64'"
- 旋转模型矩阵时的形状失真
- 成员函数调用和C++对象模型
- 连接 dockerized 模型和 dockerized 数据库时出现"无法 SQLConnect"错误
- 打印 ONNXRUNTIME::图形没有模型
- C++内存模型和位字段的最大序列
- 使用SIR模型的疾病爆发模拟
- Qt - QVector 和模型视图 - 从列表视图获取自定义类的最佳方法是什么?
- 如何在 ECS 模型中组织实体?
- 在官方张量流 resnet50 模型上运行 tflite 精度工具
- Libtorch:如何加载ONNX模型?
- 在C++中使用 Matlab SVM 模型
- 如何在LIBSVM中保存MATLAB训练的模型
- MATLAB-SIMULINK(MAC OSX)中的模型加速度
- 将matlab中的libsvm模型结构保存到可以用C++读取的.model文件中
- 如何在Matlab中训练一个模型,将其保存到磁盘,并在c++中加载程序