package libsvm

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type t

Type of a SVM problem (training set).

val create : x:Lacaml.D.mat -> y:Lacaml.D.vec -> t

create x y constructs a problem from a feature matrix x and target vector y. Each row of x is a feature vector of a training instance.

val create_k : k:Lacaml.D.mat -> y:Lacaml.D.vec -> t

create_k k y constructs a problem from a matrix k and target vector y. The matrix k has to be of the following form:

1 K(x1,x1) K(x1,x2) ... K(x1,xL)

2 K(x2,x1) K(x2,x2) ... K(x2,xL)

...

L K(xL,x1) K(xL,x2) ... K(xL,xL)

where L denotes the number of training instances and K(x,y) is the precomputed kernel value of the two training instances x and y.

val get_n_samples : t -> int

get_n_samples prob

  • returns

    the number of training samples.

val get_n_feats : t -> int

get_n_feats prob

  • returns

    the number of features (attributes).

val get_targets : t -> Lacaml.D.vec

get_targets prob

  • returns

    the targets of training instances.

val load : string -> t

load filename loads a problem from the file filename.

  • raises Failure

    if an error occured during parsing of filename.

val output : t -> out_channel -> unit

output prob oc outputs the problem prob to an output channel oc. NOTE: the function does not close the output channel.

val save : t -> string -> unit

save prob filename saves the problem prob to the file filename.

val min_max_feats : t -> [ `Min of Lacaml.D.vec ] * [ `Max of Lacaml.D.vec ]

min_max_feats prob

  • returns

    the smallest and largest feature value for each column in the feature matrix.

val scale : ?lower:float -> ?upper:float -> t -> min_feats:Lacaml.D.vec -> max_feats:Lacaml.D.vec -> t

scale ?lower ?upper prob min_feats max_feats

  • returns

    a linearly scaled problem where each feature (attribute) lies in the range [lower,upper]. The default range is [-1,1].

val print : t -> unit

print prob prints the internal representation of a problem. It is mainly used for debugging purposes.

OCaml

Innovation. Community. Security.