forked from HIT-SCIR/ltp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
7,690 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
set (svm_learn_SRC | ||
kernel.h | ||
svm_common.c | ||
svm_common.h | ||
svm_hideo.c | ||
svm_learn.c | ||
svm_learn.h | ||
svm_learn_main.c) | ||
|
||
add_executable (svm_learn | ||
${svm_learn_SRC}) | ||
|
||
set_target_properties (svm_learn | ||
PROPERTIES | ||
RUNTIME_OUTPUT_DIRECTORY ${TOOLS_DIR}/train/) | ||
|
||
target_link_libraries (svm_learn m) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
SVM-Light | ||
--------- | ||
|
||
Available at http://svmlight.joachims.org/ | ||
|
||
Author: Thorsten Joachims | ||
[email protected] | ||
|
||
Cornell University | ||
Department of Computer Science | ||
4153 Upson Hall | ||
Ithaca, NY 14853 | ||
USA | ||
|
||
LICENSING TERMS | ||
|
||
This program is granted free of charge for 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 must not be modified and 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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->words,b->words) | ||
+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)); | ||
} |
Oops, something went wrong.