http://www.sunjsp.com
Plotroc.py 是libsvm用于绘制roc曲线的一个工具,用法如下:
plotroc.py [-t kern_type][-c Cost][-g gamma][-m cache_size][-v cv_fold][-T testing_file] training_file
下载地址:http://ftp.cs.hacettepe.edu.tr/pub/dersler/BIL6XX/BIL_682_PR/libsvm-2.81/docs/libsvm%20tools.htm 。下载后存放在/libsvm/python下。
1、 接着需要做一下工作:
a) Make the libsvm python interface
b) Edit the path of gnuplot in plotroc.py in necessary
C) Put plotroc.py into the python directory of libsvm package.
检查python,gnuplot的安装路径,设置plotroc.py中gnuplot的路径。
2、参考c:/libsvm/python/README.txt 按照libsvm/python目录下的readme文件
在虚拟dos下直接运行vcvars32.bat(C:/Program Files/Microsoft Visual Studio/Vc98/bin/)。此命令设置了VC++的环境变量。
C:/>"C:/Program Files/Microsoft Visual Studio/VC98/Bin/VCVARS32.BAT
Setting environment for using Microsoft Visual C++ tools.显示:
3、运行C:/libsvm>nmake -f Makefile.win clean all 4、C:/libsvm>nmake -f Makefile.win python.显示:
Microsoft (R) Program Maintenance Utility Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.
cl.exe -nologo -O2 -EHsc -I. -D __WIN32__ -D _CRT_SECURE_NO_DEPRECATE -I
c:/python26/include -LD python/svmc_wrap.c svm.obj c:/python26/libs/python26.lib
-Fewindows/python/svmc.pyd
svmc_wrap.c
Creating library windows/python/svmc.lib and object windows/python/svmc.exp
LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use
/NODEFAULTLIB:library
a) 最后运行:C:/libsvm/python>python plotroc.py -t 2 -c 2 -g 0.5 -v 5 -T C:/libsvm/python/test.txt C:/libsvm/python/train.txt