Skip to content

Commit

Permalink
svm_struct_3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
vedaldi committed Sep 3, 2009
1 parent b006c2d commit 803e1e4
Show file tree
Hide file tree
Showing 25 changed files with 11,493 additions and 0 deletions.
61 changes: 61 additions & 0 deletions LICENSE.txt
@@ -0,0 +1,61 @@
SVM-Struct
----------

Available at http://svmlight.joachims.org/

Author: Thorsten Joachims
thorsten@joachims.org

Cornell University
Department of Computer Science
4153 Upson Hall
Ithaca, NY 14853
USA

LICENSING TERMS

This program is granted free of charge for non-commercial research and
education purposes. However you must obtain a license from the author
to use it for commercial purposes.

Scientific results produced using the software provided shall
acknowledge the use of SVM-Struct. Please cite as

I. Tsochantaridis, T. Joachims, T. Hofmann, and Y. Altun,
Large Margin Methods for Structured and Interdependent Output Variables,
Journal of Machine Learning Research (JMLR), 6(Sep):1453-1484, 2005.
http://jmlr.csail.mit.edu/papers/volume6/tsochantaridis05a/tsochantaridis05a.pdf

Moreover shall the author of SVM-Struct be informed about the
publication.

The software and derivatives of the software must not be distributed
without prior permission of the author.

By using SVM-Struct you agree to the licensing terms.


NO WARRANTY

BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT
WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF
THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO
LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY
OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED
OF THE POSSIBILITY OF SUCH DAMAGES.



56 changes: 56 additions & 0 deletions Makefile
@@ -0,0 +1,56 @@
# Makefile for empty SVM-struct API, 03.10.06

#Call 'make' using the following line to make CYGWIN produce stand-alone Windows executables
# make 'SFLAGS=-mno-cygwin'

#Use the following to compile under unix or cygwin
CC = gcc
LD = gcc

CFLAGS = $(SFLAGS) -O3 -fomit-frame-pointer -ffast-math -Wall
LDFLAGS = $(SFLAGS) -O3 -lm -Wall
#CFLAGS = $(SFLAGS) -pg -Wall
#LDFLAGS = $(SFLAGS) -pg -lm -Wall

all: svm_empty_learn svm_empty_classify

.PHONY: clean
clean: svm_light_clean svm_struct_clean
rm -f *.o *.tcov *.d core gmon.out *.stackdump

#-----------------------#
#---- SVM-light ----#
#-----------------------#
svm_light_hideo_noexe:
cd svm_light; make svm_learn_hideo_noexe

svm_light_clean:
cd svm_light; make clean

#----------------------#
#---- STRUCT SVM ----#
#----------------------#

svm_struct_noexe:
cd svm_struct; make svm_struct_noexe

svm_struct_clean:
cd svm_struct; make clean


#-------------------------#
#---- SVM empty API ----#
#-------------------------#

svm_empty_classify: svm_light_hideo_noexe svm_struct_noexe svm_struct_api.o svm_struct/svm_struct_classify.o svm_struct/svm_struct_common.o svm_struct/svm_struct_main.o
$(LD) $(LDFLAGS) svm_struct_api.o svm_struct/svm_struct_classify.o svm_light/svm_common.o svm_struct/svm_struct_common.o -o svm_empty_classify $(LIBS)

svm_empty_learn: svm_light_hideo_noexe svm_struct_noexe svm_struct_api.o svm_struct_learn_custom.o svm_struct/svm_struct_learn.o svm_struct/svm_struct_common.o svm_struct/svm_struct_main.o
$(LD) $(LDFLAGS) svm_struct/svm_struct_learn.o svm_struct_learn_custom.o svm_struct_api.o svm_light/svm_hideo.o svm_light/svm_learn.o svm_light/svm_common.o svm_struct/svm_struct_common.o svm_struct/svm_struct_main.o -o svm_empty_learn $(LIBS)


svm_struct_api.o: svm_struct_api.c svm_struct_api.h svm_struct_api_types.h svm_struct/svm_struct_common.h
$(CC) -c $(CFLAGS) svm_struct_api.c -o svm_struct_api.o

svm_struct_learn_custom.o: svm_struct_learn_custom.c svm_struct_api.h svm_light/svm_common.h svm_struct_api_types.h svm_struct/svm_struct_common.h
$(CC) -c $(CFLAGS) svm_struct_learn_custom.c -o svm_struct_learn_custom.o
20 changes: 20 additions & 0 deletions README_STRUCT.txt
@@ -0,0 +1,20 @@
Readme for the SVM-light structure learning API
-----------------------------------------------
Thorsten Joachims, 03.07.2004

The API allows to implement different versions of the learning
algorithm for learning different kinds of structures. To adapt to a
new structure, one needs to modify the files

svm_struct_api_types.h
svm_struct_api.c

Both files already contain empty templates. The first file contains
the type definitions that need to be changed. PATTERN is the structure
for storing the x-part of an example (x,y), LABEL is the y-part. The
learned model will be stored in STRUCTMODEL. Finally,
STRUCT_LEARN_PARM can be used to store any parameters that you might
want to pass to the function.

The second file contains the function you need to implement. See the
documentation in the file for details.
59 changes: 59 additions & 0 deletions svm_light/LICENSE.txt
@@ -0,0 +1,59 @@
SVM-Light
---------

Available at http://svmlight.joachims.org/

Author: Thorsten Joachims
thorsten@joachims.org

Cornell University
Department of Computer Science
4153 Upson Hall
Ithaca, NY 14853
USA

LICENSING TERMS

This program is granted free of charge for non-commercial research and
education purposes. However you must obtain a license from the author
to use it for commercial purposes.

Scientific results produced using the software provided shall
acknowledge the use of SVM-Light. Please cite as

T. Joachims, Making large-Scale SVM Learning
Practical. Advances in Kernel Methods - Support Vector
Learning, B. Sch�lkopf and C. Burges and A. Smola (ed.),
MIT-Press, 1999.
http://www-ai.cs.uni-dortmund.de/DOKUMENTE/joachims_99a.pdf

Moreover shall the author of SVM-Light be informed about the
publication.

The software or any derivative software must not be distributed
without prior permission of the author.

By using SVM-Light you agree to the licensing terms.


NO WARRANTY

BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT
WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF
THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO
LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY
OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED
OF THE POSSIBILITY OF SUCH DAMAGES.
105 changes: 105 additions & 0 deletions svm_light/Makefile
@@ -0,0 +1,105 @@
#
# makefile for svm_light
#
# Thorsten Joachims, 2002
#

#Use the following to compile under unix or cygwin
CC = gcc
LD = gcc

#Uncomment the following line to make CYGWIN produce stand-alone Windows executables
#SFLAGS= -mno-cygwin

CFLAGS= $(SFLAGS) -O3 # release C-Compiler flags
LFLAGS= $(SFLAGS) -O3 # release linker flags
#CFLAGS= $(SFLAGS) -pg -Wall -pedantic # debugging C-Compiler flags
#LFLAGS= $(SFLAGS) -pg # debugging linker flags
LIBS=-L. -lm # used libraries

all: svm_learn_hideo svm_classify

tidy:
rm -f *.o
rm -f pr_loqo/*.o

clean: tidy
rm -f svm_learn
rm -f svm_classify
rm -f libsvmlight.so

help: info

info:
@echo
@echo "make for SVM-light Thorsten Joachims, 1998"
@echo
@echo "Thanks to Ralf Herbrich for the initial version."
@echo
@echo "USAGE: make [svm_learn | svm_learn_loqo | svm_learn_hideo | "
@echo " libsvmlight_hideo | libsvmlight_loqo | "
@echo " svm_classify | all | clean | tidy]"
@echo
@echo " svm_learn builds the learning module (prefers HIDEO)"
@echo " svm_learn_hideo builds the learning module using HIDEO optimizer"
@echo " svm_learn_loqo builds the learning module using PR_LOQO optimizer"
@echo " svm_classify builds the classfication module"
@echo " libsvmlight_hideo builds shared object library that can be linked into"
@echo " other code using HIDEO"
@echo " libsvmlight_loqo builds shared object library that can be linked into"
@echo " other code using PR_LOQO"
@echo " all (default) builds svm_learn + svm_classify"
@echo " clean removes .o and target files"
@echo " tidy removes .o files"
@echo

# Create executables svm_learn and svm_classify

svm_learn_hideo: svm_learn_main.o svm_learn.o svm_common.o svm_hideo.o
$(LD) $(LFLAGS) svm_learn_main.o svm_learn.o svm_common.o svm_hideo.o -o svm_learn $(LIBS)

#svm_learn_loqo: svm_learn_main.o svm_learn.o svm_common.o svm_loqo.o loqo
# $(LD) $(LFLAGS) svm_learn_main.o svm_learn.o svm_common.o svm_loqo.o pr_loqo/pr_loqo.o -o svm_learn $(LIBS)

svm_classify: svm_classify.o svm_common.o
$(LD) $(LFLAGS) svm_classify.o svm_common.o -o svm_classify $(LIBS)


# Create library libsvmlight.so, so that external code can get access to the
# learning and classification functions of svm-light by linking this library.

svm_learn_hideo_noexe: svm_learn_main.o svm_learn.o svm_common.o svm_hideo.o

libsvmlight_hideo: svm_learn_main.o svm_learn.o svm_common.o svm_hideo.o
$(LD) -shared svm_learn.o svm_common.o svm_hideo.o -o libsvmlight.so

#svm_learn_loqo_noexe: svm_learn_main.o svm_learn.o svm_common.o svm_loqo.o loqo

#libsvmlight_loqo: svm_learn_main.o svm_learn.o svm_common.o svm_loqo.o
# $(LD) -shared svm_learn.o svm_common.o svm_loqo.o pr_loqo/pr_loqo.o -o libsvmlight.so

# Compile components

svm_hideo.o: svm_hideo.c
$(CC) -c $(CFLAGS) svm_hideo.c -o svm_hideo.o

#svm_loqo.o: svm_loqo.c
# $(CC) -c $(CFLAGS) svm_loqo.c -o svm_loqo.o

svm_common.o: svm_common.c svm_common.h kernel.h
$(CC) -c $(CFLAGS) svm_common.c -o svm_common.o

svm_learn.o: svm_learn.c svm_common.h
$(CC) -c $(CFLAGS) svm_learn.c -o svm_learn.o

svm_learn_main.o: svm_learn_main.c svm_learn.h svm_common.h
$(CC) -c $(CFLAGS) svm_learn_main.c -o svm_learn_main.o

svm_classify.o: svm_classify.c svm_common.h kernel.h
$(CC) -c $(CFLAGS) svm_classify.c -o svm_classify.o

#loqo: pr_loqo/pr_loqo.o

#pr_loqo/pr_loqo.o: pr_loqo/pr_loqo.c
# $(CC) -c $(CFLAGS) pr_loqo/pr_loqo.c -o pr_loqo/pr_loqo.o

40 changes: 40 additions & 0 deletions svm_light/kernel.h
@@ -0,0 +1,40 @@
/************************************************************************/
/* */
/* kernel.h */
/* */
/* User defined kernel function. Feel free to plug in your own. */
/* */
/* Copyright: Thorsten Joachims */
/* Date: 16.12.97 */
/* */
/************************************************************************/

/* KERNEL_PARM is defined in svm_common.h The field 'custom' is reserved for */
/* parameters of the user defined kernel. You can also access and use */
/* the parameters of the other kernels. Just replace the line
return((double)(1.0));
with your own kernel. */

/* Example: The following computes the polynomial kernel. sprod_ss
computes the inner product between two sparse vectors.
return((CFLOAT)pow(kernel_parm->coef_lin*sprod_ss(a,b)
+kernel_parm->coef_const,(double)kernel_parm->poly_degree));
*/

/* If you are implementing a kernel that is not based on a
feature/value representation, you might want to make use of the
field "userdefined" in SVECTOR. By default, this field will contain
whatever string you put behind a # sign in the example file. So, if
a line in your training file looks like
-1 1:3 5:6 #abcdefg
then the SVECTOR field "words" will contain the vector 1:3 5:6, and
"userdefined" will contain the string "abcdefg". */

double custom_kernel(KERNEL_PARM *kernel_parm, SVECTOR *a, SVECTOR *b)
/* plug in you favorite kernel */
{
return((double)(1.0));
}

0 comments on commit 803e1e4

Please sign in to comment.