Oliver Gu avatar Oliver Gu committed e139d6b

Added accessor function for total number of support vectors

Comments (0)

Files changed (3)

     external svm_get_kernel_type : model -> kernel_type = "svm_get_kernel_type_stub"
     external svm_get_nr_class : model -> int = "svm_get_nr_class_stub"
     external svm_get_labels : model -> int list = "svm_get_labels_stub"
+    external svm_get_nr_sv : model -> int = "svm_get_nr_sv_stub"
     external svm_get_svr_probability :
       model -> float = "svm_get_svr_probability_stub"
     external svm_check_probability_model :
         invalid_arg "Cannot return labels for a regression or one-class model."
       | _ -> Stub.svm_get_labels t
+    let get_n_sv t = Stub.svm_get_nr_sv t
     let get_svr_probability t =
       match Stub.svm_get_svm_type t with
       | EPSILON_SVR | NU_SVR -> Stub.svm_get_svr_probability t
         @raise Invalid_argument in the case of a regression or one-class model. *)
     val get_labels : t -> int list
+    (** [get_n_sv model] @return the total number of support vectors. *)
+    val get_n_sv : t -> int
+    (* val get_sv_indices : t ->  *)
     (** [get_svr_probability model] @return a positive value for a regression
         model with probability information. In the case of no probability
         information, 0 is returned.


+CAMLprim value svm_get_nr_sv_stub(value v_model)
+  CAMLparam1(v_model);
+  CAMLreturn(Val_long(Svm_model_val(v_model)->l));
 CAMLprim value svm_get_svr_probability_stub(value v_model)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.