diff -uNr svmlight_orig/labels svmlight/labels
--- svmlight_orig/labels	Thu Jan  1 02:00:00 1970
+++ svmlight/labels	Tue May 31 18:22:48 2005
@@ -0,0 +1,7 @@
+#!/usr/bin/perl
+
+while(<>) {
+  chomp;
+  @labels = split(' ',$_);
+  print $labels[0] . "\n";
+}
diff -uNr svmlight_orig/predict svmlight/predict
--- svmlight_orig/predict	Thu Jan  1 02:00:00 1970
+++ svmlight/predict	Tue May 31 18:22:48 2005
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+svm_classify -v 1 $1 ${2}_model $3
diff -uNr svmlight_orig/svm_classify.c svmlight/svm_classify.c
--- svmlight_orig/svm_classify.c	Wed Jul 14 21:50:00 2004
+++ svmlight/svm_classify.c	Tue May 31 18:22:48 2005
@@ -38,6 +38,7 @@
   long j;
   double t1,runtime=0;
   double dist,doc_label,costfactor;
+  double model_length;
   char *line,*comment; 
   FILE *predfl,*docfl;
   MODEL *model; 
@@ -53,6 +54,7 @@
   words = (WORD *)my_malloc(sizeof(WORD)*(max_words_doc+10));
 
   model=read_model(modelfile);
+  model_length = model_length_s(model, &model->kernel_parm);
 
   if(model->kernel_parm.kernel_type == 0) { /* linear kernel */
     /* compute weight vector */
@@ -79,15 +81,17 @@
 	  (words[j]).wnum=0;               /* model. Remove feature if   */
       }                                        /* necessary.                 */
       doc = create_example(-1,0,0,0.0,create_svector(words,comment,1.0));
+      doc->fvec->factor = 1.0/sqrt(kernel(&model->kernel_parm,doc,doc));
       t1=get_runtime();
-      dist=classify_example_linear(model,doc);
+      dist=classify_example_linear(model,doc)/model_length;
       runtime+=(get_runtime()-t1);
       free_example(doc,1);
     }
     else {                             /* non-linear kernel */
       doc = create_example(-1,0,0,0.0,create_svector(words,comment,1.0));
+      doc->fvec->factor = 1.0/sqrt(kernel(&model->kernel_parm,doc,doc));
       t1=get_runtime();
-      dist=classify_example(model,doc);
+      dist=classify_example(model,doc)/model_length;
       runtime+=(get_runtime()-t1);
       free_example(doc,1);
     }
@@ -106,7 +110,7 @@
       if(doc_label>0) res_c++; else res_d++;
     }
     if(pred_format==1) { /* output the value of decision function */
-      fprintf(predfl,"%.8g\n",dist);
+      fprintf(predfl,"%d %.8g\n",(dist > 0 ? 1 : -1),dist);
     }
     if((int)(0.01+(doc_label*doc_label)) != 1) 
       { no_accuracy=1; } /* test data is not binary labeled */
diff -uNr svmlight_orig/svm_learn_main.c svmlight/svm_learn_main.c
--- svmlight_orig/svm_learn_main.c	Thu Aug 26 03:03:59 2004
+++ svmlight/svm_learn_main.c	Tue May 31 18:22:48 2005
@@ -49,6 +49,9 @@
   read_input_parameters(argc,argv,docfile,modelfile,restartfile,&verbosity,
 			&learn_parm,&kernel_parm);
   read_documents(docfile,&docs,&target,&totwords,&totdoc);
+  for(i = 0; i < totdoc; i++) {
+    docs[i]->fvec->factor = 1.0/sqrt(kernel(&kernel_parm, docs[i], docs[i])); 
+  } 
   if(restartfile[0]) alpha_in=read_alphas(restartfile,totdoc);
 
   if(kernel_parm.kernel_type == LINEAR) { /* don't need the cache */
diff -uNr svmlight_orig/train svmlight/train
--- svmlight_orig/train	Thu Jan  1 02:00:00 1970
+++ svmlight/train	Tue May 31 18:22:48 2005
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+DIRNAME=`dirname $1`
+svm_learn -z c -b 0 `cat ${DIRNAME}/params` $1 ${1}_model
