Commits

Oliver Gu  committed 9848880

Added accessor function for training set targets.

  • Participants
  • Parent commits 08ddf6b

Comments (0)

Files changed (2)

File lib/libsvm.ml

         prob;
       }
 
+    let get_targets t =
+      let n = t.n_samples in
+      let y = Vec.create n in
+      for i = 1 to n do
+        y.{i} <- Stub.svm_problem_y_get t.prob (i-1)
+      done;
+      y
+
     let output t oc =
       let buf = Buffer.create 1024 in
       for i = 0 to t.n_samples-1 do

File lib/libsvm.mli

     (** [get_n_feats prob] @return the number of features (attributes). *)
     val get_n_feats : t -> int
 
+    (** [get_targets prob] @return the targets of training instances. *)
+    val get_targets : t -> vec
+
     (** [load filename] loads a problem from the file [filename].
         @raise Failure if an error occured during parsing of [filename]. *)
     val load : string -> t