shark::WeightedUnlabeledData< DataT > Class Template Reference

Weighted data set for unsupervised learning. More...

#include <shark/Data/WeightedDataset.h>

+ Inheritance diagram for shark::WeightedUnlabeledData< DataT >:

Public Types

typedef base_type::DataType DataType
 
typedef base_type::WeightType WeightType
 
typedef DataT InputType
 

Public Member Functions

 BOOST_STATIC_CONSTANT (std::size_t, DefaultBatchSize=UnlabeledData< DataT >::DefaultBatchSize)
 
 WeightedUnlabeledData ()
 Empty data set. More...
 
 WeightedUnlabeledData (std::size_t numBatches)
 Create an empty set with just the correct number of batches. More...
 
 WeightedUnlabeledData (std::size_t size, element_type const &element, std::size_t batchSize=DefaultBatchSize)
 Construtor using a single element as blueprint to create a dataset with a specified number of elements. More...
 
 WeightedUnlabeledData (UnlabeledData< DataType > const &data, Data< WeightType > const &weights)
 Construction from data. More...
 
 WeightedUnlabeledData (UnlabeledData< DataType > const &data, double weight)
 Construction from data and a constant weight for all elements. More...
 
UnlabeledData< DataT > const & inputs () const
 Access to the inputs as a separate container. More...
 
UnlabeledData< DataT > & inputs ()
 Access to the inputs as a separate container. More...
 
Shape const & shape () const
 Returns the Shape of the data. More...
 
Shapeshape ()
 Returns the Shape of the data. More...
 
WeightedUnlabeledData 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...
 

Friends

void swap (WeightedUnlabeledData &a, WeightedUnlabeledData &b)
 

Detailed Description

template<class DataT>
class shark::WeightedUnlabeledData< DataT >

Weighted data set for unsupervised learning.

The WeightedUnlabeledData class extends UnlabeledData for the representation of data. In addition it holds and provides access to the corresponding weights.

WeightedUnlabeledData tries to mimic the underlying data as pairs of data points and weights. 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).data and the weights by batch(i).weight

this also holds true for single element access using operator(). Be aware, that direct access to 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 446 of file WeightedDataset.h.

Member Typedef Documentation

◆ DataType

template<class DataT>
typedef base_type::DataType shark::WeightedUnlabeledData< DataT >::DataType

Definition at line 453 of file WeightedDataset.h.

◆ InputType

template<class DataT>
typedef DataT shark::WeightedUnlabeledData< DataT >::InputType

Definition at line 456 of file WeightedDataset.h.

◆ WeightType

template<class DataT>
typedef base_type::WeightType shark::WeightedUnlabeledData< DataT >::WeightType

Definition at line 454 of file WeightedDataset.h.

Constructor & Destructor Documentation

◆ WeightedUnlabeledData() [1/5]

template<class DataT>
shark::WeightedUnlabeledData< DataT >::WeightedUnlabeledData ( )
inline

Empty data set.

Definition at line 463 of file WeightedDataset.h.

◆ WeightedUnlabeledData() [2/5]

template<class DataT>
shark::WeightedUnlabeledData< DataT >::WeightedUnlabeledData ( std::size_t  numBatches)
inline

Create an empty set with just the correct number of batches.

The user must initialize the dataset after that by himself.

Definition at line 469 of file WeightedDataset.h.

◆ WeightedUnlabeledData() [3/5]

template<class DataT>
shark::WeightedUnlabeledData< DataT >::WeightedUnlabeledData ( std::size_t  size,
element_type const &  element,
std::size_t  batchSize = DefaultBatchSize 
)
inline

Construtor using a single element as blueprint to create a dataset with a specified number of elements.

Optionally the desired batch Size can be set

Parameters
sizethe new size of the container
elementthe blueprint element from which to create the Container
batchSizethe size of the batches. if this is 0, the size is unlimited

Definition at line 480 of file WeightedDataset.h.

◆ WeightedUnlabeledData() [4/5]

template<class DataT>
shark::WeightedUnlabeledData< DataT >::WeightedUnlabeledData ( UnlabeledData< DataType > const &  data,
Data< WeightType > const &  weights 
)
inline

Construction from data.

Beware that when calling this constructor the organization of batches must be equal in both containers. This Constructor will not reorganize the data!

Definition at line 487 of file WeightedDataset.h.

◆ WeightedUnlabeledData() [5/5]

template<class DataT>
shark::WeightedUnlabeledData< DataT >::WeightedUnlabeledData ( UnlabeledData< DataType > const &  data,
double  weight 
)
inline

Construction from data and a constant weight for all elements.

Definition at line 492 of file WeightedDataset.h.

Member Function Documentation

◆ BOOST_STATIC_CONSTANT()

template<class DataT>
shark::WeightedUnlabeledData< DataT >::BOOST_STATIC_CONSTANT ( std::size_t  ,
DefaultBatchSize  = UnlabeledData< DataT >::DefaultBatchSize 
)

◆ inputs() [1/2]

template<class DataT>
UnlabeledData<DataT> const& shark::WeightedUnlabeledData< DataT >::inputs ( ) const
inline

Access to the inputs as a separate container.

Definition at line 499 of file WeightedDataset.h.

References shark::WeightedDataPair< DataType, WeightType >::data.

◆ inputs() [2/2]

template<class DataT>
UnlabeledData<DataT>& shark::WeightedUnlabeledData< DataT >::inputs ( )
inline

Access to the inputs as a separate container.

Definition at line 503 of file WeightedDataset.h.

References shark::WeightedDataPair< DataType, WeightType >::data.

◆ shape() [1/2]

template<class DataT>
Shape const& shark::WeightedUnlabeledData< DataT >::shape ( ) const
inline

Returns the Shape of the data.

Definition at line 508 of file WeightedDataset.h.

References shark::WeightedDataPair< DataType, WeightType >::data.

Referenced by shark::bootstrap().

◆ shape() [2/2]

template<class DataT>
Shape& shark::WeightedUnlabeledData< DataT >::shape ( )
inline

Returns the Shape of the data.

Definition at line 513 of file WeightedDataset.h.

References shark::WeightedDataPair< DataType, WeightType >::data.

◆ splice()

template<class DataT>
WeightedUnlabeledData shark::WeightedUnlabeledData< DataT >::splice ( std::size_t  batch)
inline

Splits the container into two independent parts. The left part remains in the container, the right is stored as return type.

Order of elements remain unchanged. The SharedVector is not allowed to be shared for this to work.

Definition at line 520 of file WeightedDataset.h.

References shark::WeightedDataPair< DataType, WeightType >::data.

Friends And Related Function Documentation

◆ swap

template<class DataT>
void swap ( WeightedUnlabeledData< DataT > &  a,
WeightedUnlabeledData< DataT > &  b 
)
friend

Definition at line 524 of file WeightedDataset.h.


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