]> granicus.if.org Git - liblinear/commitdiff
remove trailing spaces and tabs
authorKevin <b03902086@ntu.edu.tw>
Mon, 13 Mar 2017 07:22:41 +0000 (15:22 +0800)
committerKevin <b03902086@ntu.edu.tw>
Mon, 13 Mar 2017 07:22:41 +0000 (15:22 +0800)
16 files changed:
Makefile.win
blas/Makefile
blas/blasp.h
blas/daxpy.c
blas/ddot.c
blas/dnrm2.c
blas/dscal.c
linear.cpp
linear.h
matlab/Makefile
matlab/libsvmread.c
matlab/libsvmwrite.c
matlab/train.c
python/README
python/liblinear.py
python/liblinearutil.py

index 9b3b8c6533cac2670baf10b8723fbcfd13e8235e..f5d91a64b7f19517cc39753a021c3ac0cf3e2cef 100644 (file)
@@ -17,7 +17,7 @@ tron.obj: tron.cpp tron.h
        $(CXX) $(CFLAGS) -c tron.cpp
 
 lib: linear.cpp linear.h linear.def tron.obj
-       $(CXX) $(CFLAGS) -LD linear.cpp tron.obj blas\*.c -Fe$(TARGET)\liblinear -link -DEF:linear.def 
+       $(CXX) $(CFLAGS) -LD linear.cpp tron.obj blas\*.c -Fe$(TARGET)\liblinear -link -DEF:linear.def
 
 clean:
         -erase /Q *.obj $(TARGET)\*.exe $(TARGET)\*.dll $(TARGET)\*.exp $(TARGET)\*.lib
index 895fd244cdbc7d5cb517f6b6a39ba5d80582aa03..ff4278932b500f4d95bd480190bfd986214de260 100644 (file)
@@ -1,14 +1,14 @@
 AR     = ar rcv
-RANLIB = ranlib 
+RANLIB = ranlib
 
 HEADERS = blas.h blasp.h
-FILES = dnrm2.o daxpy.o ddot.o dscal.o 
+FILES = dnrm2.o daxpy.o ddot.o dscal.o
 
-CFLAGS = $(OPTFLAGS) 
+CFLAGS = $(OPTFLAGS)
 FFLAGS = $(OPTFLAGS)
 
 blas: $(FILES) $(HEADERS)
-       $(AR) blas.a $(FILES)  
+       $(AR) blas.a $(FILES)
        $(RANLIB) blas.a
 
 clean:
index fbf6e7fe096dd4cce6677d358b9db284b4aed411..d0fe8eca0da4844e8b6f1ee9f8269551856574b7 100644 (file)
@@ -170,7 +170,7 @@ int dgemm_(char *transa, char *transb, int *m, int *n, int *k,
            double *beta, double *c, int *ldc);
 
 int dgemv_(char *trans, int *m, int *n, double *alpha, double *a,
-           int *lda, double *x, int *incx, double *beta, double *y, 
+           int *lda, double *x, int *incx, double *beta, double *y,
            int *incy);
 
 int dger_(int *m, int *n, double *alpha, double *x, int *incx,
@@ -182,7 +182,7 @@ int drot_(int *n, double *sx, int *incx, double *sy, int *incy,
 int drotg_(double *sa, double *sb, double *c, double *s);
 
 int dsbmv_(char *uplo, int *n, int *k, double *alpha, double *a,
-           int *lda, double *x, int *incx, double *beta, double *y, 
+           int *lda, double *x, int *incx, double *beta, double *y,
            int *incy);
 
 int dscal_(int *n, double *sa, double *sx, int *incx);
@@ -231,14 +231,14 @@ int dtpsv_(char *uplo, char *trans, char *diag, int *n, double *ap,
            double *x, int *incx);
 
 int dtrmm_(char *side, char *uplo, char *transa, char *diag, int *m,
-           int *n, double *alpha, double *a, int *lda, double *b, 
+           int *n, double *alpha, double *a, int *lda, double *b,
            int *ldb);
 
 int dtrmv_(char *uplo, char *trans, char *diag, int *n, double *a,
            int *lda, double *x, int *incx);
 
 int dtrsm_(char *side, char *uplo, char *transa, char *diag, int *m,
-           int *n, double *alpha, double *a, int *lda, double *b, 
+           int *n, double *alpha, double *a, int *lda, double *b,
            int *ldb);
 
 int dtrsv_(char *uplo, char *trans, char *diag, int *n, double *a,
@@ -258,7 +258,7 @@ int sgemm_(char *transa, char *transb, int *m, int *n, int *k,
            float *beta, float *c, int *ldc);
 
 int sgemv_(char *trans, int *m, int *n, float *alpha, float *a,
-           int *lda, float *x, int *incx, float *beta, float *y, 
+           int *lda, float *x, int *incx, float *beta, float *y,
            int *incy);
 
 int sger_(int *m, int *n, float *alpha, float *x, int *incx,
@@ -270,7 +270,7 @@ int srot_(int *n, float *sx, int *incx, float *sy, int *incy,
 int srotg_(float *sa, float *sb, float *c, float *s);
 
 int ssbmv_(char *uplo, int *n, int *k, float *alpha, float *a,
-           int *lda, float *x, int *incx, float *beta, float *y, 
+           int *lda, float *x, int *incx, float *beta, float *y,
            int *incy);
 
 int sscal_(int *n, float *sa, float *sx, int *incx);
@@ -319,14 +319,14 @@ int stpsv_(char *uplo, char *trans, char *diag, int *n, float *ap,
            float *x, int *incx);
 
 int strmm_(char *side, char *uplo, char *transa, char *diag, int *m,
-           int *n, float *alpha, float *a, int *lda, float *b, 
+           int *n, float *alpha, float *a, int *lda, float *b,
            int *ldb);
 
 int strmv_(char *uplo, char *trans, char *diag, int *n, float *a,
            int *lda, float *x, int *incx);
 
 int strsm_(char *side, char *uplo, char *transa, char *diag, int *m,
-           int *n, float *alpha, float *a, int *lda, float *b, 
+           int *n, float *alpha, float *a, int *lda, float *b,
            int *ldb);
 
 int strsv_(char *uplo, char *trans, char *diag, int *n, float *a,
index f762bd53f5015cb213cc64aeb8caf5db4a1bd338..0a3c5942b3b587bd6b4bf5670dd82fc65f91f724 100644 (file)
@@ -10,9 +10,9 @@ int daxpy_(int *n, double *sa, double *sx, int *incx, double *sy,
   long int i, m, ix, iy, nn, iincx, iincy;
   register double ssa;
 
-  /* constant times a vector plus a vector.   
-     uses unrolled loop for increments equal to one.   
-     jack dongarra, linpack, 3/11/78.   
+  /* constant times a vector plus a vector.
+     uses unrolled loop for increments equal to one.
+     jack dongarra, linpack, 3/11/78.
      modified 12/3/93, array(1) declarations changed to array(*) */
 
   /* Dereference inputs */
index adc0965416cd0341fe16784b929c8b55e6fbb670..294f4ed84317c60563542d4b38ca3c9ee4e437ea 100644 (file)
@@ -10,9 +10,9 @@ double ddot_(int *n, double *sx, int *incx, double *sy, int *incy)
   double stemp;
   long int ix, iy;
 
-  /* forms the dot product of two vectors.   
-     uses unrolled loops for increments equal to one.   
-     jack dongarra, linpack, 3/11/78.   
+  /* forms the dot product of two vectors.
+     uses unrolled loops for increments equal to one.
+     jack dongarra, linpack, 3/11/78.
      modified 12/3/93, array(1) declarations changed to array(*) */
 
   /* Dereference inputs */
index 78987832dfa546218f437f9bf8387379383b188e..d80b1a5be99202a5ef7b0bee9022839d3c65d211 100644 (file)
@@ -10,13 +10,13 @@ double dnrm2_(int *n, double *x, int *incx)
   long int ix, nn, iincx;
   double norm, scale, absxi, ssq, temp;
 
-/*  DNRM2 returns the euclidean norm of a vector via the function   
-    name, so that   
+/*  DNRM2 returns the euclidean norm of a vector via the function
+    name, so that
 
-       DNRM2 := sqrt( x'*x )   
+       DNRM2 := sqrt( x'*x )
 
-    -- This version written on 25-October-1982.   
-       Modified on 14-October-1993 to inline the call to SLASSQ.   
+    -- This version written on 25-October-1982.
+       Modified on 14-October-1993 to inline the call to SLASSQ.
        Sven Hammarling, Nag Ltd.   */
 
   /* Dereference inputs */
@@ -28,13 +28,13 @@ double dnrm2_(int *n, double *x, int *incx)
     if (nn == 1)
     {
       norm = fabs(x[0]);
-    }  
+    }
     else
     {
       scale = 0.0;
       ssq = 1.0;
 
-      /* The following loop is equivalent to this call to the LAPACK 
+      /* The following loop is equivalent to this call to the LAPACK
          auxiliary routine:   CALL SLASSQ( N, X, INCX, SCALE, SSQ ) */
 
       for (ix=(nn-1)*iincx; ix>=0; ix-=iincx)
index 2bbdebcc00e28c6c85700fa0d7176f924fb9e12f..5edbe8b255363ae8722f5dd4a1e52ecd8d6a0008 100644 (file)
@@ -9,10 +9,10 @@ int dscal_(int *n, double *sa, double *sx, int *incx)
   long int i, m, nincx, nn, iincx;
   double ssa;
 
-  /* scales a vector by a constant.   
-     uses unrolled loops for increment equal to 1.   
-     jack dongarra, linpack, 3/11/78.   
-     modified 3/93 to return if incx .le. 0.   
+  /* scales a vector by a constant.
+     uses unrolled loops for increment equal to 1.
+     jack dongarra, linpack, 3/11/78.
+     modified 3/93 to return if incx .le. 0.
      modified 12/3/93, array(1) declarations changed to array(*) */
 
   /* Dereference inputs */
index e1d12e3a11f8274a7c4e772b30c58093e0d2bbfc..5136261c8d972110e2f91ed89bddfba0510e4056 100644 (file)
@@ -1187,7 +1187,7 @@ void solve_l2r_lr_dual(const problem *prob, double *w, double eps, double Cp, do
        int i, s, iter = 0;
        double *xTx = new double[l];
        int max_iter = 1000;
-       int *index = new int[l];        
+       int *index = new int[l];
        double *alpha = new double[2*l]; // store alpha and C - alpha
        schar *y = new schar[l];
        int max_inner_iter = 100; // for inner Newton
@@ -1206,7 +1206,7 @@ void solve_l2r_lr_dual(const problem *prob, double *w, double eps, double Cp, do
                        y[i] = -1;
                }
        }
-       
+
        // Initial alpha can be set here. Note that
        // 0 < alpha[i] < upper_bound[GETI(i)]
        // alpha[2*i] + alpha[2*i+1] = upper_bound[GETI(i)]
index bc6aaf8b6e1ec716902c0cb2d587e6ca06fa2ba7..b6086dadfe93889dabc46979fb0c702cc6eff9e2 100644 (file)
--- a/linear.h
+++ b/linear.h
@@ -16,7 +16,7 @@ struct problem
        int l, n;
        double *y;
        struct feature_node **x;
-       double bias;            /* < 0 if no bias term */  
+       double bias;            /* < 0 if no bias term */
 };
 
 enum { L2R_LR, L2R_L2LOSS_SVC_DUAL, L2R_L2LOSS_SVC, L2R_L1LOSS_SVC_DUAL, MCSVM_CS, L1R_L2LOSS_SVC, L1R_LR, L2R_LR_DUAL, L2R_L2LOSS_SVR = 11, L2R_L2LOSS_SVR_DUAL, L2R_L1LOSS_SVR_DUAL }; /* solver_type */
index a2c02845d3ff414ddab11ef05ee90bb301af06a8..8826a40983b816e558123a642f51963762b58f56 100644 (file)
@@ -38,7 +38,7 @@ linear_model_matlab.o: linear_model_matlab.c ../linear.h
 ../linear.o: ../linear.cpp ../linear.h
        make -C .. linear.o
 
-../tron.o: ../tron.cpp ../tron.h 
+../tron.o: ../tron.cpp ../tron.h
        make -C .. tron.o
 
 ../blas/blas.a: ../blas/*.c ../blas/*.h
index d2fe0f5cb8753388f1c4734a9ea0a01abecc4db1..21291df19de94dd2d7b12cd9bce35639e41e3e63 100644 (file)
@@ -9,8 +9,8 @@
 #ifdef MX_API_VER
 #if MX_API_VER < 0x07030000
 typedef int mwIndex;
-#endif 
-#endif 
+#endif
+#endif
 #ifndef max
 #define max(x,y) (((x)>(y))?(x):(y))
 #endif
@@ -38,7 +38,7 @@ static int max_line_len;
 static char* readline(FILE *input)
 {
        int len;
-       
+
        if(fgets(line,max_line_len,input) == NULL)
                return NULL;
 
index 9c93fd3f6a6928eeb852ef67ca81ff54d53d6d3a..3c59178854fab43c45ece5300b7a0dafba414241 100644 (file)
@@ -33,7 +33,7 @@ void libsvmwrite(const char *filename, const mxArray *label_vec, const mxArray *
 
        if(fp ==NULL)
        {
-               mexPrintf("can't open output file %s\n",filename);                      
+               mexPrintf("can't open output file %s\n",filename);
                return;
        }
 
@@ -72,7 +72,7 @@ void libsvmwrite(const char *filename, const mxArray *label_vec, const mxArray *
 
                low = jc[i], high = jc[i+1];
                for(k=low;k<high;k++)
-                       fprintf(fp," %lu:%g", (size_t)ir[k]+1, samples[k]);             
+                       fprintf(fp," %lu:%g", (size_t)ir[k]+1, samples[k]);
 
                fprintf(fp,"\n");
        }
@@ -90,30 +90,30 @@ void mexFunction( int nlhs, mxArray *plhs[],
                fake_answer(nlhs, plhs);
                return;
        }
-       
+
        // Transform the input Matrix to libsvm format
        if(nrhs == 3)
        {
                char filename[256];
                if(!mxIsDouble(prhs[1]) || !mxIsDouble(prhs[2]))
                {
-                       mexPrintf("Error: label vector and instance matrix must be double\n");                  
+                       mexPrintf("Error: label vector and instance matrix must be double\n");
                        return;
                }
-               
-               mxGetString(prhs[0], filename, mxGetN(prhs[0])+1);              
+
+               mxGetString(prhs[0], filename, mxGetN(prhs[0])+1);
 
                if(mxIsSparse(prhs[2]))
                        libsvmwrite(filename, prhs[1], prhs[2]);
                else
                {
-                       mexPrintf("Instance_matrix must be sparse\n");                  
+                       mexPrintf("Instance_matrix must be sparse\n");
                        return;
                }
        }
        else
        {
-               exit_with_help();               
+               exit_with_help();
                return;
        }
 }
index 5c3ef4a79c2bcf8eb5ac40178eac2b0908884968..1c7730adba3c3bd9de860e1e7997b9e5111355c7 100644 (file)
@@ -28,7 +28,7 @@ void exit_with_help()
        "-s type : set type of solver (default 1)\n"
        "  for multi-class classification\n"
        "        0 -- L2-regularized logistic regression (primal)\n"
-       "        1 -- L2-regularized L2-loss support vector classification (dual)\n"    
+       "        1 -- L2-regularized L2-loss support vector classification (dual)\n"
        "        2 -- L2-regularized L2-loss support vector classification (primal)\n"
        "        3 -- L2-regularized L1-loss support vector classification (dual)\n"
        "        4 -- support vector classification by Crammer and Singer\n"
@@ -42,12 +42,12 @@ void exit_with_help()
        "-c cost : set the parameter C (default 1)\n"
        "-p epsilon : set the epsilon in loss function of SVR (default 0.1)\n"
        "-e epsilon : set tolerance of termination criterion\n"
-       "       -s 0 and 2\n" 
-       "               |f'(w)|_2 <= eps*min(pos,neg)/l*|f'(w0)|_2,\n" 
-       "               where f is the primal function and pos/neg are # of\n" 
+       "       -s 0 and 2\n"
+       "               |f'(w)|_2 <= eps*min(pos,neg)/l*|f'(w0)|_2,\n"
+       "               where f is the primal function and pos/neg are # of\n"
        "               positive/negative data (default 0.01)\n"
        "       -s 11\n"
-       "               |f'(w)|_2 <= eps*|f'(w0)|_2 (default 0.001)\n" 
+       "               |f'(w)|_2 <= eps*|f'(w0)|_2 (default 0.001)\n"
        "       -s 1, 3, 4 and 7\n"
        "               Dual maximal violation <= eps; similar to libsvm (default 0.1)\n"
        "       -s 5 and 6\n"
@@ -89,7 +89,7 @@ void do_find_parameter_C(double *best_C, double *best_rate)
        else
                start_C = -1.0;
        find_parameter_C(&prob, &param, nr_fold, start_C, max_C, best_C, best_rate);
-       mexPrintf("Best C = %lf  CV accuracy = %g%%\n", *best_C, 100.0**best_rate);     
+       mexPrintf("Best C = %lf  CV accuracy = %g%%\n", *best_C, 100.0**best_rate);
 }
 
 
@@ -103,8 +103,8 @@ double do_cross_validation()
        double retval = 0.0;
 
        cross_validation(&prob,&param,nr_fold,target);
-       if(param.solver_type == L2R_L2LOSS_SVR || 
-          param.solver_type == L2R_L1LOSS_SVR_DUAL || 
+       if(param.solver_type == L2R_L2LOSS_SVR ||
+          param.solver_type == L2R_L1LOSS_SVR_DUAL ||
           param.solver_type == L2R_L2LOSS_SVR_DUAL)
        {
                for(i=0;i<prob.l;i++)
@@ -261,20 +261,20 @@ int parse_command_line(int nrhs, const mxArray *prhs[], char *model_file_name)
        {
                switch(param.solver_type)
                {
-                       case L2R_LR: 
+                       case L2R_LR:
                        case L2R_L2LOSS_SVC:
                                param.eps = 0.01;
                                break;
                        case L2R_L2LOSS_SVR:
                                param.eps = 0.001;
                                break;
-                       case L2R_L2LOSS_SVC_DUAL: 
-                       case L2R_L1LOSS_SVC_DUAL: 
-                       case MCSVM_CS: 
-                       case L2R_LR_DUAL: 
+                       case L2R_L2LOSS_SVC_DUAL:
+                       case L2R_L1LOSS_SVC_DUAL:
+                       case MCSVM_CS:
+                       case L2R_LR_DUAL:
                                param.eps = 0.1;
                                break;
-                       case L1R_L2LOSS_SVC: 
+                       case L1R_L2LOSS_SVC:
                        case L1R_LR:
                                param.eps = 0.01;
                                break;
@@ -333,7 +333,7 @@ int read_problem_sparse(const mxArray *label_vec, const mxArray *instance_mat)
                mexPrintf("Length of label vector does not match # of instances.\n");
                return -1;
        }
-       
+
        // each column is one instance
        labels = mxGetPr(label_vec);
        samples = mxGetPr(instance_mat_col);
@@ -453,9 +453,9 @@ void mexFunction( int nlhs, mxArray *plhs[],
                if (flag_find_C)
                {
                        double best_C, best_rate, *ptr;
-                       
-                       do_find_parameter_C(&best_C, &best_rate);       
-                       
+
+                       do_find_parameter_C(&best_C, &best_rate);
+
                        plhs[0] = mxCreateDoubleMatrix(2, 1, mxREAL);
                        ptr = mxGetPr(plhs[0]);
                        ptr[0] = best_C;
index 47e0b4a04dd7f4f334feafbe4cffda3eb2357dc7..6a6210932a2b30af48e5fdcbfc746783e304fdb4 100644 (file)
@@ -120,7 +120,7 @@ LIBLINEAR shared library:
 
     Show the index and the value of a node.
 
-    >>> print(node) 
+    >>> print(node)
 
 - Function: gen_feature_nodearray(xi [,feature_max=None [,issparse=True]])
 
@@ -149,7 +149,7 @@ LIBLINEAR shared library:
     x: a Python list/tuple of l data instances. Each element of x must be
        an instance of list/tuple/dictionary type.
 
-    bias: if bias >= 0, instance x becomes [x; bias]; if < 0, no bias term 
+    bias: if bias >= 0, instance x becomes [x; bias]; if < 0, no bias term
           added (default -1)
 
     You can also modify the bias value by
@@ -277,9 +277,9 @@ The above command loads
            structure. If '-v' is specified, cross validation is
            conducted and the returned model is just a scalar: cross-validation
            accuracy for classification and mean-squared error for regression.
-           If the '-C' option is specified, the best parameter C is found 
-          by cross validation. The returned model is a tuple of the best C 
-          and the corresponding cross-validation accuracy. The parameter 
+           If the '-C' option is specified, the best parameter C is found
+          by cross validation. The returned model is a tuple of the best C
+          and the corresponding cross-validation accuracy. The parameter
           selection utility is supported by only -s 0 and -s 2.
 
 
@@ -322,11 +322,11 @@ The above command loads
            squared error, and squared correlation coefficient (for
            regression).
 
-    p_vals: a list of decision values or probability estimates (if '-b 1' 
+    p_vals: a list of decision values or probability estimates (if '-b 1'
             is specified). If k is the number of classes, for decision values,
             each element includes results of predicting k binary-class
-            SVMs. If k = 2 and solver is not MCSVM_CS, only one decision value 
-            is returned. For probabilities, each element contains k values 
+            SVMs. If k = 2 and solver is not MCSVM_CS, only one decision value
+            is returned. For probabilities, each element contains k values
             indicating the probability that the testing instance is in each class.
             Note that the order of classes here is the same as 'model.label'
             field in the model structure.
index d6500626f83b867d19a30639a31d489d7317446c..e5dbf44300659fbd2979c92786991ce0eb1b7cd5 100644 (file)
@@ -7,8 +7,8 @@ import sys
 
 __all__ = ['liblinear', 'feature_node', 'gen_feature_nodearray', 'problem',
            'parameter', 'model', 'toPyModel', 'L2R_LR', 'L2R_L2LOSS_SVC_DUAL',
-           'L2R_L2LOSS_SVC', 'L2R_L1LOSS_SVC_DUAL', 'MCSVM_CS', 
-           'L1R_L2LOSS_SVC', 'L1R_LR', 'L2R_LR_DUAL', 'L2R_L2LOSS_SVR', 
+           'L2R_L2LOSS_SVC', 'L2R_L1LOSS_SVC_DUAL', 'MCSVM_CS',
+           'L1R_L2LOSS_SVC', 'L1R_LR', 'L2R_LR_DUAL', 'L2R_L2LOSS_SVR',
            'L2R_L2LOSS_SVR_DUAL', 'L2R_L1LOSS_SVR_DUAL', 'print_null']
 
 try:
@@ -27,25 +27,25 @@ except:
                raise Exception('LIBLINEAR library not found.')
 
 L2R_LR = 0
-L2R_L2LOSS_SVC_DUAL = 1 
-L2R_L2LOSS_SVC = 2 
+L2R_L2LOSS_SVC_DUAL = 1
+L2R_L2LOSS_SVC = 2
 L2R_L1LOSS_SVC_DUAL = 3
-MCSVM_CS = 4 
-L1R_L2LOSS_SVC = 5 
-L1R_LR = 6 
-L2R_LR_DUAL = 7  
+MCSVM_CS = 4
+L1R_L2LOSS_SVC = 5
+L1R_LR = 6
+L2R_LR_DUAL = 7
 L2R_L2LOSS_SVR = 11
 L2R_L2LOSS_SVR_DUAL = 12
 L2R_L1LOSS_SVR_DUAL = 13
 
 PRINT_STRING_FUN = CFUNCTYPE(None, c_char_p)
-def print_null(s): 
-       return 
+def print_null(s):
+       return
 
-def genFields(names, types): 
+def genFields(names, types):
        return list(zip(names, types))
 
-def fillprototype(f, restype, argtypes): 
+def fillprototype(f, restype, argtypes):
        f.restype = restype
        f.argtypes = argtypes
 
@@ -69,7 +69,7 @@ def gen_feature_nodearray(xi, feature_max=None, issparse=True):
        if feature_max:
                assert(isinstance(feature_max, int))
                index_range = filter(lambda j: j <= feature_max, index_range)
-       if issparse: 
+       if issparse:
                index_range = filter(lambda j:xi[j] != 0, index_range)
 
        index_range = sorted(index_range)
@@ -80,7 +80,7 @@ def gen_feature_nodearray(xi, feature_max=None, issparse=True):
                ret[idx].index = j
                ret[idx].value = xi[j]
        max_idx = 0
-       if index_range : 
+       if index_range :
                max_idx = index_range[-1]
        return ret, max_idx
 
@@ -106,18 +106,18 @@ class problem(Structure):
                self.y = (c_double * l)()
                for i, yi in enumerate(y): self.y[i] = y[i]
 
-               self.x = (POINTER(feature_node) * l)() 
+               self.x = (POINTER(feature_node) * l)()
                for i, xi in enumerate(self.x_space): self.x[i] = xi
 
                self.set_bias(bias)
 
        def set_bias(self, bias):
                if self.bias == bias:
-                       return 
-               if bias >= 0 and self.bias < 0: 
+                       return
+               if bias >= 0 and self.bias < 0:
                        self.n += 1
                        node = feature_node(self.n, bias)
-               if bias < 0 and self.bias >= 0: 
+               if bias < 0 and self.bias >= 0:
                        self.n -= 1
                        node = feature_node(-1, bias)
 
@@ -139,7 +139,7 @@ class parameter(Structure):
        def __str__(self):
                s = ''
                attrs = parameter._names + list(self.__dict__.keys())
-               values = map(lambda attr: getattr(self, attr), attrs) 
+               values = map(lambda attr: getattr(self, attr), attrs)
                for attr, val in zip(attrs, values):
                        s += (' %s: %s\n' % (attr, val))
                s = s.strip()
@@ -217,7 +217,7 @@ class parameter(Structure):
                liblinear.set_print_string_function(self.print_func)
                self.weight_label = (c_int*self.nr_weight)()
                self.weight = (c_double*self.nr_weight)()
-               for i in range(self.nr_weight): 
+               for i in range(self.nr_weight):
                        self.weight[i] = weight[i]
                        self.weight_label[i] = weight_label[i]
 
index cb5e60beed8eaa93b579424a171d945e2c86b4c1..0ca44c2fd3aeed819331aab8699ce1825ca9b16c 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 
 import os, sys
-sys.path = [os.path.dirname(os.path.abspath(__file__))] + sys.path 
+sys.path = [os.path.dirname(os.path.abspath(__file__))] + sys.path
 from liblinear import *
 from liblinear import __all__ as liblinear_all
 from ctypes import c_double
@@ -153,7 +153,7 @@ def train(arg1, arg2=None, arg3=None):
        if param.flag_find_C:
                nr_fold = param.nr_fold
                best_C = c_double()
-               best_rate = c_double()          
+               best_rate = c_double()
                max_C = 1024
                if param.flag_C_specified:
                        start_C = param.C