From fa71eaa240a858f5e7e8bfa20ebd8217170c02f3 Mon Sep 17 00:00:00 2001 From: Ding-Yi Chen Date: Wed, 29 Aug 2007 06:47:34 +0000 Subject: [PATCH] Commit to CVS --- .cvsignore | 1 + ChangeLog | 127 ++++++++++++++++++++++++++++++++++++ libsvm-2.84-2.patch | 153 ++++++++++++++++++++++++++++++++++++++++++++ libsvm.spec | 105 ++++++++++++++++++++++++++++++ sources | 1 + 5 files changed, 387 insertions(+) create mode 100644 ChangeLog create mode 100644 libsvm-2.84-2.patch create mode 100644 libsvm.spec diff --git a/.cvsignore b/.cvsignore index e69de29..9161481 100644 --- a/.cvsignore +++ b/.cvsignore @@ -0,0 +1 @@ +libsvm-2.84.tar.gz diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..d0f9c71 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,127 @@ +1.04: 2000/6/17, add "load" button to svm-toy. README +file updated. + +2.0: 2000/8, major updates. Include nu-svm, one-class svm, and svr + +2.01: 2000/9/22, correct the calculation of obj value and number of bounded support vectors + +2.02: 2000/9/29, replace b^2/2 newsvm to regular nu svm. + +2.03: 2000/10/24 some improvements on the computational speed + +2.1: 2000/12/19 Java version included, regression demonstrated in svm-toy + +2.2: 2001/1/16 multi-class classification, nu-SVR, remove epsilon_a + +2.3: 2001/3/15 c+-, cross validation, fix some minor bugs + +2.31: 2001/4/12 fix one bug on one-class SVM, use float for Cache + +2.32: 2001/9/23 + 1. max line number of svm-scale now dynamic + 2. gcc 3.0 problem: now g++ always used + 3. java code in a "libsvm" package + 4. avoid a problem when compiled with Borland C++ builder + +2.33: 2001/12/1 + Python interface added + +2.34: 2002/6/15 + Add the subroutine svm_check_parameter in svm.cpp + --> better error handling + fix bug of python interface for handling different weights + fix bug of cross validation in svm-train.c + +2.35: 2002/6/16 + libsvm.jar was not compiled correctly in 2.34 + +2.36: 2002/8/4 + grid.py added: contour plot of CV accuracy + fix several bugs + +2.4: 2003/4/1 + svm.cpp + non-psd kernel using max(...,0) in svm.cpp + python interface + python interface bug (nu-svm) + grid.py + -log2c and -log2c for grid.py + output current best + coarse grid as default (2) + ssh for grid.py + improvements of scaling + +2.5: 2003/11/13 + subroutines for accessing decision values and number of labels. + for svm.cpp, java, and python interface + fix bug of svm-scale.c (about -r and -s factors) + use fscanf but not sscanf in svm-predict.c (faster) + makefile for windows + add "using namespace std;" in some .java files + improve easy.py: output cv rate, error messages printed + better checking + better python interface example svm_test.py + and some minor updates + +2.6: 2004/04/01 + Probability estimates for classification/regression + Python interface: use swig 1.3 instead of 1.1 + Cross validation becomes a library subroutine + A few minor corrections: (not completely listed) + more interface functions such as getting svm_type + print nu only when Cp=Cn + floor division in python interface + +2.7: 2004/11/10 + Stratified cross validation + Better faq + Scaling: support storing the factor of y + A few minor updates: + class QMatrix added + improve the use of easy.py and grid.py on windows + grid.py: same CV and same g: use smaller C + sparse input for python interface + working set selection: < to <= + +2.71: 2004/11/20 + fix a java bug introduced from 2.6 to 2.7 + +2.8: 2005/04/01 + new working set selection via second order information + fix minor changes/corrections: + problem when cache size less than two kernel columns + -v #data -> stratified CV is not loo -> ensure loo is done + problem of typing "svm-train -c" only + problem of "svm-train -n 1 -s 3 ..." + python interface makefile: -fPIC for 32/64bit + color change in svmtoy + makefile in building QT svmtoy + +2.81: 2005/11/20 + add a python script subset.py for subsampling + slightly modify the working set so it's exact the same as the paper + default cache size to 100 MB + +2.82: 2006/04/01 + precomputed kernel + directly implement a fast powi() function + poly degree double to int + minor corrections: + java code for CV +2.83: 2006/11/17 + Fix the bug of -t 3 + better checking load/save in svm-train.c/svm-predict.c/svm.cpp + remove redundant var pos in svm_predict_values (thanks to Albert Strasheim) + Better descriptions in README for the precomputed kernel + +2.84: 2007/04/01 + Improve the shrinking code: faster for some cases + Code more 64-bit friendly: allow large -m + In Solver, b is replaced by p + Subroutine max_violating_pair removed. Things are directly + written in do_shrinking(). + Modify do_shrinking() so variable names are the same as libsvm + document + +2.85: 2007/11/? + fix minor memory leak in svm-predict.c \ No newline at end of file diff --git a/libsvm-2.84-2.patch b/libsvm-2.84-2.patch new file mode 100644 index 0000000..ef48c43 --- /dev/null +++ b/libsvm-2.84-2.patch @@ -0,0 +1,153 @@ +--- ./Makefile.orig 2007-08-22 15:23:34.000000000 +1000 ++++ ./Makefile 2007-08-27 15:48:58.000000000 +1000 +@@ -1,7 +1,31 @@ + CXXC = g++ + CFLAGS = -Wall -O3 ++MAKE = make + +-all: svm-train svm-predict svm-scale ++ifndef DESTDIR ++INSTDIR=/usr ++else ++INSTDIR=${DESTDIR}/usr ++endif ++ ++export INSTDIR ++ ++PROCESSOR=$(shell /bin/uname -p) ++ifeq "${PROCESSOR}" "x86_64" ++X86_64=64 ++else ++X86_64= ++endif ++ ++ifndef LIBDIR ++LIB_INSTDIR=${INSTDIR}/lib${X86_64} ++else ++LIB_INSTDIR=${INSTDIR}/..${LIBDIR} ++endif ++ ++export LIB_INSTDIR ++ ++all: svm-train svm-predict svm-scale svm-python + + svm-predict: svm-predict.c svm.o + $(CXXC) $(CFLAGS) svm-predict.c svm.o -o svm-predict -lm +@@ -11,5 +35,45 @@ + $(CXXC) $(CFLAGS) svm-scale.c -o svm-scale + svm.o: svm.cpp svm.h + $(CXXC) $(CFLAGS) -c svm.cpp ++svm-python: ++ ${MAKE} -C python ++ ++install: all ++ mkdir -p ${INSTDIR}/bin ++ install -m 755 svm-train ${INSTDIR}/bin ++ install -m 755 svm-predict ${INSTDIR}/bin ++ install -m 755 svm-scale ${INSTDIR}/bin ++ mkdir -p ${LIB_INSTDIR}/libsvm ++# install package libsvm-devel ++ install -m 644 svm.o ${LIB_INSTDIR}/libsvm ++ mkdir -p ${INSTDIR}/include/libsvm ++ install -m 644 svm.h ${INSTDIR}/include/libsvm ++ mkdir -p ${INSTDIR}/share/libsvm/src ++ install -m 644 *.h ${INSTDIR}/share/libsvm/src ++ install -m 644 *.c ${INSTDIR}/share/libsvm/src ++ install -m 644 *.cpp ${INSTDIR}/share/libsvm/src ++ install -m 644 Makefile ${INSTDIR}/share/libsvm/src ++ cp -R java ${INSTDIR}/share/libsvm/src ++ cp -R svm-toy ${INSTDIR}/share/libsvm/src ++# cp -R tools ${INSTDIR}/share/libsvm/src ++# cp -R windows ${INSTDIR}/share/libsvm/src ++ mkdir -p ${INSTDIR}/share/libsvm/examples ++ install -m 644 heart_scale ${INSTDIR}/share/libsvm/examples ++# install package libsvm-python ++ ${MAKE} -C python install ++ ++uninstall: ++ rm -f ${INSTDIR}/bin/svm-train ++ rm -f ${INSTDIR}/bin/svm-predict ++ rm -f ${INSTDIR}/bin/svm-scale ++ rm -fr ${INSTDIR}/libsvm/examples ++ rm -f ${INSTDIR}/include/libsvm/svm.h ++ rm -f ${LIB_INSTDIR}/libsvm/svm.o ++ rm -fr ${INSTDIR}/libsvm/src ++ rm -fr ${INSTDIR}/libsvm ++ ${MAKE} -C python uninstall ++ + clean: + rm -f *~ svm.o svm-train svm-predict svm-scale ++ ${MAKE} -C python clean ++ +--- ./python/Makefile.orig 2007-08-27 11:11:38.000000000 +1000 ++++ ./python/Makefile 2007-08-28 11:15:18.000000000 +1000 +@@ -2,13 +2,19 @@ + SWIG ?= swig + + #Windows: see ../README ../Makefile.win +-PYTHON_INCLUDEDIR ?= /usr/include/python2.4 ++PYTHON_VERSION=${shell python -V 2> python.ver ; cat python.ver | awk 'BEGIN {FS= "[ .]"} {printf("%s.%s",$$2,$$3)}'; rm -f python.ver} ++ ++ifndef PYTHON_INCLUDEDIR ++ ++PYTHON_INCLUDEDIR?= /usr/include/python${PYTHON_VERSION} ++ ++endif ++PYTHON_TARGETDIR=${LIB_INSTDIR}/python${PYTHON_VERSION}/site-packages/libsvm + + CFLAGS = -O3 -I$(PYTHON_INCLUDEDIR) -I.. + LDFLAGS = -shared + # Mac OS + # LDFLAGS = -framework Python -bundle +- + all: svmc.so + + svmc.so: svmc_wrap.o svm.o +@@ -28,3 +34,19 @@ + + moreclean: clean + rm -f svmc_wrap.c ++ ++install: all ++ mkdir -p ${PYTHON_TARGETDIR} ++ install -m 755 cross_validation.py ${PYTHON_TARGETDIR} ++ install -m 644 svm.py ${PYTHON_TARGETDIR} ++ install -m 755 svm_test.py ${PYTHON_TARGETDIR} ++ install -m 755 test_cross_validation.py ${PYTHON_TARGETDIR} ++ install -m 644 *.i ${PYTHON_TARGETDIR} ++ install -m 755 *.so ${PYTHON_TARGETDIR} ++ install -m 755 ../tools/*.py ${PYTHON_TARGETDIR} ++ ++uninstall: ++ rm -fr ${LIBDIR}/python${PYTHON_VERSION}/site-packages/libsvm ++ ++ ++ +--- ./tools/grid.py.orig 2007-08-28 11:48:03.000000000 +1000 ++++ ./tools/grid.py 2007-08-28 11:58:22.000000000 +1000 +@@ -11,7 +11,7 @@ + + is_win32 = (sys.platform == 'win32') + if not is_win32: +- svmtrain_exe = "../svm-train" ++ svmtrain_exe = "/usr/bin/svm-train" + gnuplot_exe = "/usr/bin/gnuplot" + else: + # example for windows +--- ./tools/easy.py.orig 2007-08-28 11:47:53.000000000 +1000 ++++ ./tools/easy.py 2007-08-28 12:13:58.000000000 +1000 +@@ -11,10 +11,10 @@ + + is_win32 = (sys.platform == 'win32') + if not is_win32: +- svmscale_exe = "../svm-scale" +- svmtrain_exe = "../svm-train" +- svmpredict_exe = "../svm-predict" +- grid_py = "./grid.py" ++ svmscale_exe = "/usr/bin/svm-scale" ++ svmtrain_exe = "/usr/bin/svm-train" ++ svmpredict_exe = "/usr/bin/svm-predict" ++ grid_py = sys.argv[0].replace("easy.py","grid.py") + gnuplot_exe = "/usr/bin/gnuplot" + else: + # example for windows diff --git a/libsvm.spec b/libsvm.spec new file mode 100644 index 0000000..6239e20 --- /dev/null +++ b/libsvm.spec @@ -0,0 +1,105 @@ +Name: libsvm +Version: 2.84 +Release: 3%{?dist} +Summary: A Library for Support Vector Machines + +Group: Development/Libraries +License: BSD +URL: http://www.csie.ntu.edu.tw/~cjlin/libsvm/ +Source0: %{name}-%{version}.tar.gz +#Source0: http://www.csie.ntu.edu.tw/~cjlin/cgi-bin/libsvm.cgi?+http://www.csie.ntu.edu.tw/~cjlin/%{name}+tar.gz +Source1: ChangeLog +#Source1: http://www.csie.ntu.edu.tw/~cjlin/libsvm/log +Patch0: libsvm-2.84-2.patch +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +BuildRequires: glibc-devel dos2unix +Requires: glibc + + +%description +LIBSVM is an integrated software for support vector classification, +(C-SVC, nu-SVC ), regression (epsilon-SVR, nu-SVR) and distribution +estimation (one-class SVM ). It supports multi-class classification. + +%package devel +Summary: A Library for Support Vector Machines +Group: Development/Libraries +BuildRequires: glibc-devel +Requires: glibc +Requires: %{name} = %{version}-%{release} + +%description devel +The libsvm-devel package includes the header file, object file, and +soucre in C and Java. +Install this package if you want to develop programs with libsvm. + +%package python +Summary: A Library for Support Vector Machines +Group: Development/Libraries +BuildRequires: python >= 2.4 python-devel >= 2.4 +Requires: python >= 2.4 +Requires: %{name} = %{version}-%{release} + +%description python +The libsvm-python provides tools and interface written in python, +as well as source code. Install this package if you want to develop +programs with libsvm in Python. + +%prep +%setup -q +%patch0 -p0 -b .bak +%define temp_file /tmp/python.ver +%define python_version %(python -V 2> %{temp_file} ; cat %{temp_file} | awk 'BEGIN {FS= "[ .]"} {printf("%s.%s",$2,$3)}'; rm -f %{temp_file}) +%define libsvm_python_dir %{_libdir}/python%{python_version}/site-packages/libsvm + + +%build +make all DESTDIR=%{_builddir} LIBDIR=%{_libdir} +dos2unix -o %{_builddir}/%{name}-%{version}/FAQ.html +mv %{_builddir}/%{name}-%{version}/python/README %{_builddir}/%{name}-%{version}/python/README-Python +mv %{_builddir}/%{name}-%{version}/tools/README %{_builddir}/%{name}-%{version}/tools/README-Tools + +%install +rm -rf $RPM_BUILD_ROOT +make install DESTDIR=$RPM_BUILD_ROOT LIBDIR=%{_libdir} + + + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root,-) +%doc COPYRIGHT FAQ.html +%{_bindir}/svm-predict +%{_bindir}/svm-scale +%{_bindir}/svm-train +%{_datadir}/libsvm/examples + +%files devel +%doc README +%{_libdir}/libsvm +%{_includedir}/libsvm +%{_datadir}/libsvm/src + +%files python +%doc python/README-Python tools/README-Tools +%{libsvm_python_dir} + + +%changelog +* Mon Aug 27 2007 Ding-Yi Chen - 2.84-3 +- Fix dependency problem + +* Mon Aug 27 2007 Ding-Yi Chen - 2.84-2 +- Fix mock error +- Support Python 2.4 and Python 2.5 + +* Mon Aug 27 2007 Ding-Yi Chen - 2.84-1 +- Fix rpmlint error +- Move python related files to libsvm-python + +* Fri Aug 17 2007 Ding-Yi Chen - 2.84-0 +- initial packaging + diff --git a/sources b/sources index e69de29..502194e 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +a7bd21b21510e9634950715c2b4a4ce9 libsvm-2.84.tar.gz