Provided by: libalgorithm-svm-perl_0.13-2build5_amd64 

NAME
Algorithm::SVM::DataSet - A DataSet object for the Algorithm::SVM Support Vector Machine.
SYNOPSIS
use Algorithm::SVM::DataSet;
# Create a new dataset.
$ds = new Algorithm::SVM::DataSet(Label => 1,
Data => [ 0.12, 0.25, 0.33, 0.98 ]);
# Retrieve/set the label.
$label = $ds->label();
$ds->label(1976);
# Retrieve/set the attribute with an index of 0.
$attr = $ds->attribute(0);
$ds->attribute(0, 0.2621);
DESCRIPTION
Algorithm::SVM::DataSet is a representation of the datasets passed to Algorithm::SVM object for training
or classification. Each dataset has an associated label, which classifies it as being part of a specific
group. A dataset object also has one or more key/value pairs corresponding to the attributes that will
be used for classification. Values equal to zero will not be stored, and are returned by default if no
key/value pair exists. This sparse format saves memory, and is treated in exactly the same way by libsvm.
CONSTRUCTORS
$ds = new Algorithm::SVM::DataSet(Label => 1,
Data => [ 0.12, 0.25, 0.33, 0.98 ]);
The Algorithm::SVM::DataSet constructor accepts two optional named parameters: Label and Data. Label is
used to set the class to which the dataset belongs, and Data is used to set any initial values. Data
should be an arrayref of numerical values. Each value in the arrayref is assumed to have a key
corresponding to its index in the array.
ie) In the above example, 0.12 has a key of 0, 0.25 has a key of 1,
0.33 has a key of 2, etc.
METHODS
$label = $ds->label();
$ds->label(1976);
The label method is used to set or retrieve the DataSets label value. Parameters and return values
should be numeric values.
$attr = $ds->attribute(0);
$ds->attribute(0, 0.2621);
The attribute method is used to set dataset attribute values. If a single value is provided, the method
will return the corresponding value. If two value are provided, the method will set the first parameter
to the value of the second.
$ds->asArray();
The asArray method returns the contents of a DataSet object in an efficient way. An optional parameter,
$numAttr, can be used to pad the array with zeros if the number of attributes is not known from the
beginning (e.g. when creating a word vector on the fly, since all keys not given are automatically
assumed to be zero)
MAINTAINER
Matthew Laird <matt@brinkman.mbb.sfu.ca> Alexander K. Seewald <alex@seewald.at>
SEE ALSO
Algorithm::SVM
perl v5.30.0 2020-03-22 Algorithm::SVM::DataSet(3pm)