shark::LabeledData< InputT, LabelT > Class Template Reference

Data set for supervised learning. More...

#include <shark/Data/Dataset.h>

+ Inheritance diagram for shark::LabeledData< InputT, LabelT >:

Public Types

typedef InputT InputType
 
typedef LabelT LabelType
 
typedef UnlabeledData< InputT > InputContainer
 
typedef Data< LabelT > LabelContainer
 
typedef InputContainer::IndexSet IndexSet
 
typedef InputLabelBatch< typename Batch< InputType >::type &, typename Batch< LabelType >::type &> batch_reference
 
typedef InputLabelBatch< typename Batch< InputType >::type const &, typename Batch< LabelType >::type const &> const_batch_reference
 
typedef batch_reference::reference element_reference
 
typedef const_batch_reference::const_reference const_element_reference
 
typedef boost::iterator_range< detail::DataElementIterator< LabeledData< InputType, LabelType > > > element_range
 
typedef boost::iterator_range< detail::DataElementIterator< LabeledData< InputType, LabelType > const > > const_element_range
 
typedef detail::BatchRange< LabeledData< InputType, LabelType > > batch_range
 
typedef detail::BatchRange< LabeledData< InputType, LabelType > const > const_batch_range
 

Public Member Functions

const_element_range elements () const
 Returns the range of elements. More...
 
element_range elements ()
 Returns therange of elements. More...
 
const_batch_range batches () const
 Returns the range of batches. More...
 
batch_range batches ()
 Returns the range of batches. More...
 
std::size_t numberOfBatches () const
 Returns the number of batches of the set. More...
 
std::size_t numberOfElements () const
 Returns the total number of elements. More...
 
bool empty () const
 Check whether the set is empty. More...
 
InputContainer const & inputs () const
 Access to inputs as a separate container. More...
 
InputContainerinputs ()
 Access to inputs as a separate container. More...
 
LabelContainer const & labels () const
 Access to labels as a separate container. More...
 
LabelContainerlabels ()
 Access to labels as a separate container. More...
 
 LabeledData ()
 Empty data set. More...
 
 LabeledData (std::size_t numBatches)
 Create an empty set with just the correct number of batches. More...
 
 LabeledData (std::size_t size, element_type const &element, std::size_t batchSize=DefaultBatchSize)
 
 LabeledData (Data< InputType > const &inputs, Data< LabelType > const &labels)
 Construction from data. More...
 
element_reference element (std::size_t i)
 
const_element_reference element (std::size_t i) const
 
batch_reference batch (std::size_t i)
 
const_batch_reference batch (std::size_t i) const
 
Shape const & inputShape () const
 Returns the Shape of the inputs. More...
 
ShapeinputShape ()
 Returns the Shape of the inputs. More...
 
Shape const & labelShape () const
 Returns the Shape of the labels. More...
 
ShapelabelShape ()
 Returns the Shape of the labels. More...
 
void read (InArchive &archive)
 from ISerializable More...
 
void write (OutArchive &archive) const
 from ISerializable More...
 
virtual void makeIndependent ()
 This method makes the vector independent of all siblings and parents. More...
 
virtual void shuffle ()
 shuffles all elements in the entire dataset (that is, also across the batches) More...
 
void splitBatch (std::size_t batch, std::size_t elementIndex)
 
LabeledData splice (std::size_t batch)
 Splits the container into two independent parts. The left part remains in the container, the right is stored as return type. More...
 
void append (LabeledData const &other)
 Appends the contents of another data object to the end. More...
 
void push_back (typename Batch< InputType >::type const &inputs, typename Batch< LabelType >::type const &labels)
 
void push_back (const_batch_reference batch)
 
template<class Range >
void repartition (Range const &batchSizes)
 Reorders the batch structure in the container to that indicated by the batchSizes vector. More...
 
std::vector< std::size_t > getPartitioning () const
 Creates a vector with the batch sizes of every batch. More...
 
LabeledData indexedSubset (IndexSet const &indices) const
 Fill in the subset defined by the list of indices. More...
 
- Public Member Functions inherited from shark::ISerializable
virtual ~ISerializable ()
 Virtual d'tor. More...
 
void load (InArchive &archive, unsigned int version)
 Versioned loading of components, calls read(...). More...
 
void save (OutArchive &archive, unsigned int version) const
 Versioned storing of components, calls write(...). More...
 
 BOOST_SERIALIZATION_SPLIT_MEMBER ()
 

Static Public Attributes

static const std::size_t DefaultBatchSize = InputContainer::DefaultBatchSize
 

Protected Attributes

InputContainer m_data
 
LabelContainer m_label
 point data More...
 

Friends

void swap (LabeledData &a, LabeledData &b)
 

Detailed Description

template<class InputT, class LabelT>
class shark::LabeledData< InputT, LabelT >

Data set for supervised learning.

The LabeledData class extends UnlabeledData for the representation of inputs. In addition it holds and provides access to the corresponding labels.

LabeledData tries to mimic the underlying data as pairs of input and label data. this means that when accessing a batch by calling batch(i) or choosing one of the iterators one access the input batch by batch(i).input and the labels by batch(i).label

this also holds true for single element access using operator(). Be aware, that direct access to an element is a linear time operation. So it is not advisable to iterate over the elements, but instead iterate over the batches.

Definition at line 467 of file Dataset.h.


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