Liblinear and Libsvm-rank训练数据的bash代码:
for j in "amazon_mp3" "video_surveillance" "tablets" "mobilephone" "cameras" "TripAdvisor" "chunyu" "Treebank" "MovieReview" "yelp_review" "LargeMovie" "Electronics_5" "Health_and_Personal_Care_5" "Apps_for_Android_5" "Home_and_Kitchen_5"
do
echo -e "SVC bias $j "
./train -s 3 -c 0.03125 -v 5 -B 1 -C $j.train
./predict $j.test $j.train.model SVC1.$j.out.txt
echo -e "SVOR bias $j "
./train -s 8 -c 0.03125 -v 5 -B 1 -m 2 -C $j.train
./predict $j.test $j.train.model SVOR1.$j.out.txt
echo -e "REDSVM bias $j "
./train -s 8 -c 0.03125 -v 5 -B 1 -m 1 -C $j.train
./predict $j.test $j.train.model REDSVM1.$j.out.txt
echo -e "SVMOP bias $j "
./train -s 10 -c 0.03125 -v 5 -B 1 -m 2 -C $j.train
./predict $j.test $j.train.model SVMOP1.$j.out.txt
echo -e "NPSVOR bias $j "
./train -s 9 -c 0.03125 -v 5 -B 1 -C $j.train
./predict $j.test $j.train.model NPSVOR1.$j.out.txt
echo -e "SVR bias $j "
./train -s 13 -c 0.03125 -p 0.1 -B 1 -v 5 -C $j.train
./predict $j.test $j.train.model SVR1.$j.out.txt
done data=("amazon_mp3" "video_surveillance" "tablets" "mobilephone" "cameras" "TripAdvisor" "chunyu" "Treebank" "MovieReview" "yelp_review" "LargeMovie" "Electronics_5" "Health_and_Personal_Care_5" "Apps_for_Android_5" "Home_and_Kitchen_5")
redsvm=(0.5 1 0.5 0.5 1 0.5 2 0.25 8 0.25 0.25 1 0.5 1 1)
svor=(1 1 0.5 0.5 1 0.5 2 2 4 0.25 0.125 1 0.25 1 1)
for k in {0..14}
do
j=${data[$k]}
cr=${redsvm[$k]}
cs=${svor[$k]}
echo -e "SVOR bias $j "
./svm-train -s 6 -t 0 -c $cs $j.train
./svm-predict $j.test $j.train.model SVOR1.$j.out.txt
echo -e "REDSVM bias $j "
./svm-train -s 5 -t 0 -c $cr $j.train
./svm-predict $j.test $j.train.model REDSVM1.$j.out.txt
done