libeblearn
ebl::labeled_datasource< Tnet, Tdata, Tlabel > Class Template Reference

#include <datasource.h>

Inheritance diagram for ebl::labeled_datasource< Tnet, Tdata, Tlabel >:
ebl::datasource< Tnet, Tdata > ebl::class_datasource< Tnet, Tdata, Tlabel > ebl::labeled_pair_datasource< Tnet, Tdata, Tlabel > ebl::hierarchy_datasource< Tnet, Tdata, Tlabel > ebl::mnist_datasource< Tnet, Tdata, Tlabel >

List of all members.

Public Member Functions

 labeled_datasource ()
 CAUTION: This empty constructor requires a subsequent call to init().
 labeled_datasource (midx< Tdata > &data, idx< Tlabel > &labels, const char *name=NULL)
 labeled_datasource (idx< Tdata > &data, idx< Tlabel > &labels, const char *name=NULL)
 labeled_datasource (const char *root_ds, const char *name=NULL)
 labeled_datasource (const char *root, const char *data_name, const char *labels_name, const char *jitters_name=NULL, const char *scales_name=NULL, const char *name=NULL)
virtual ~labeled_datasource ()
 Destructor.
void init (midx< Tdata > &data, idx< Tlabel > &labels, const char *name)
 Initialize from matrices, where data is a multi-matrix.
void init (idx< Tdata > &data, idx< Tlabel > &labels, const char *name)
 Initialize from matrices.
void init (const char *data_fname, const char *labels_fname, const char *jitters_fname=NULL, const char *name=NULL, const char *scales_fname=NULL, uint max_size=0)
void init_root (const char *root, const char *data_fname, const char *labels_fname, const char *jitters_fname=NULL, const char *scales_fname=NULL, const char *name=NULL)
 Intialize from root and partial matrices filenames.
void init_root (const char *root_dsname, const char *name=NULL)
virtual void fprop (bbstate_idx< Tnet > &out, bbstate_idx< Tlabel > &label)
virtual void fprop_label (fstate_idx< Tlabel > &s)
 Copy current sample's label into s.
virtual void fprop_label_net (fstate_idx< Tnet > &s)
virtual void fprop_label_net (bbstate_idx< Tnet > &s)
virtual void fprop_jitter (bbstate_idx< Tnet > &s)
 Copy current sample's jitter into s.
virtual intg fprop_scale ()
 Returns a scale id for this sample.
virtual bool included_sample (intg index)
 This returns true if sample with 'index' is considered for training.
virtual intg count_included_samples ()
 This returns the number of samples actually considered for training.
virtual void pretty ()
 Print info about the datasource on the standard output.
virtual void pretty_scales ()
 Print info about the scales data on the standard output.
virtual idxdim label_dims ()
 Returns the dimensions of a single label.
virtual void set_label_bias (Tnet bias)
 Set the bias to add to the labels (before multiplying by coeff).
virtual void set_label_coeff (Tnet coeff)
 Set the coefficient to multiply the labels with (after adding bias).
virtual bool has_scales ()
 Returns true if this dataset contains scale information.

Protected Member Functions

void init_labels (idx< Tlabel > &labels, const char *name)
 Initialize labels. This should only be called by init().

Protected Attributes

Tnet label_bias
Tnet label_coeff
idx< Tlabel > labels
idx< intg > scales
midx< float > jitters
 Jitter information.
bool scales_loaded
 Scales info was loaded or not.
idxdim jitters_maxdim
 Maximum dimensions in jitters matrices.
idxdim labeldims
 Dimensions of a label.

Friends

class labeled_datasource_gui
class supervised_trainer
class supervised_trainer_gui

Detailed Description

template<typename Tnet, typename Tdata, typename Tlabel>
class ebl::labeled_datasource< Tnet, Tdata, Tlabel >

labeled_datasource A datasource associating samples with their corresponding label. A label is not necessarly a discrete class label, it can be continuous values in a regression setting. For discrete classification purpose, use 'class_datasource'.


Constructor & Destructor Documentation

template<typename Tnet , typename Tdata , typename Tlabel >
ebl::labeled_datasource< Tnet, Tdata, Tlabel >::labeled_datasource ( midx< Tdata > &  data,
idx< Tlabel > &  labels,
const char *  name = NULL 
)

Construct a datasource associating 'data' and its 'labels' where data is a multi-matrix matrix (midx type). This allows for dynamic loading of data and avoids the need to fit all data in memory.

Parameters:
nameAn optional name for this dataset.
template<typename Tnet , typename Tdata , typename Tlabel >
ebl::labeled_datasource< Tnet, Tdata, Tlabel >::labeled_datasource ( idx< Tdata > &  data,
idx< Tlabel > &  labels,
const char *  name = NULL 
)

Construct a datasource associating 'data' and its 'labels'.

Parameters:
nameAn optional name for this dataset.
template<typename Tnet , typename Tdata , typename Tlabel >
ebl::labeled_datasource< Tnet, Tdata, Tlabel >::labeled_datasource ( const char *  root_ds,
const char *  name = NULL 
)

Constructor from the full general name (i.e. root/dataset) but without the individual file names such as "_data.mat". This appends names and extension of each subfile of a dataset created with the dscompile tool.

Parameters:
nameAn optional name for this dataset.
template<typename Tnet , typename Tdata , typename Tlabel >
ebl::labeled_datasource< Tnet, Tdata, Tlabel >::labeled_datasource ( const char *  root,
const char *  data_name,
const char *  labels_name,
const char *  jitters_name = NULL,
const char *  scales_name = NULL,
const char *  name = NULL 
)

Constructor from data root and names for data, labels and classes files (appending names and extension of each subfile of a dataset created with the dscompile tool).

Parameters:
nameAn optional name for this dataset.

Member Function Documentation

template<typename Tnet , typename Tdata , typename Tlabel >
void ebl::labeled_datasource< Tnet, Tdata, Tlabel >::fprop ( bbstate_idx< Tnet > &  out,
bbstate_idx< Tlabel > &  label 
) [virtual]

get the current item and copy the sample into <out> (an idx3-state) and the corresponding label into <lbl> (and idx0 of int).

template<typename Tnet , typename Tdata , typename Tlabel >
void ebl::labeled_datasource< Tnet, Tdata, Tlabel >::fprop_label_net ( bbstate_idx< Tnet > &  s) [virtual]

Copy current sample's label into s (name has to be different than fprop_label in case Tnet == Tlabel).

Reimplemented in ebl::hierarchy_datasource< Tnet, Tdata, Tlabel >.

template<typename Tnet , typename Tdata , typename Tlabel >
void ebl::labeled_datasource< Tnet, Tdata, Tlabel >::fprop_label_net ( fstate_idx< Tnet > &  s) [virtual]

Copy current sample's label into s (name has to be different than fprop_label in case Tnet == Tlabel).

Reimplemented in ebl::hierarchy_datasource< Tnet, Tdata, Tlabel >.

template<typename Tnet , typename Tdata , typename Tlabel >
void ebl::labeled_datasource< Tnet, Tdata, Tlabel >::init ( const char *  data_fname,
const char *  labels_fname,
const char *  jitters_fname = NULL,
const char *  name = NULL,
const char *  scales_fname = NULL,
uint  max_size = 0 
)

Intialize from matrices filenames.

Parameters:
max_sizeIf > 0, limit the number of samples to this value.
template<typename Tnet , typename Tdata , typename Tlabel >
void ebl::labeled_datasource< Tnet, Tdata, Tlabel >::init_root ( const char *  root_dsname,
const char *  name = NULL 
)

Initialize from data root and names for data, labels and classes files (appending names and extension of each subfile of a dataset created with the dscompile tool).

Reimplemented in ebl::class_datasource< Tnet, Tdata, Tlabel >.


The documentation for this class was generated from the following files: