Commits

Oliver Gu  committed ed7cef2

Gamma parameters are now passed on correctly in Svm.train and Svm.cross_validation.

  • Participants
  • Parent commits b6f7142

Comments (0)

Files changed (1)

File lib/libsvm.ml

       ?(svm_type=`C_SVC)
       ?(kernel=`RBF)
       ?(degree=3)
-      ?(gamma=0.)
+      ?gamma
       ?(coef0=0.)
       ?(c=1.)
       ?(nu=0.5)
       ?(verbose=false)
       problem =
     let params = create_params
-      ~gamma:(1. /. float problem.Problem.n_feats)
+      ~gamma:(Option.value gamma ~default:(1. /. float problem.Problem.n_feats))
       ~svm_type ~kernel ~degree ~coef0 ~c ~nu ~eps
       ~cachesize ~tol ~shrinking ~probability ~weights
     in
       ?(svm_type=`C_SVC)
       ?(kernel=`RBF)
       ?(degree=3)
-      ?(gamma=0.)
+      ?gamma
       ?(coef0=0.)
       ?(c=1.)
       ?(nu=0.5)
       ?(verbose=false)
       ~n_folds problem =
     let params = create_params
-      ~gamma:(1. /. float problem.Problem.n_feats)
+      ~gamma:(Option.value gamma ~default:(1. /. float problem.Problem.n_feats))
       ~svm_type ~kernel ~degree ~coef0 ~c ~nu ~eps
       ~cachesize ~tol ~shrinking ~probability ~weights
     in