Weighted data set for supervised learning. More...
#include <shark/Data/WeightedDataset.h>
Public Types | |
typedef base_type::DataType | DataType |
typedef base_type::WeightType | WeightType |
typedef InputT | InputType |
typedef LabelT | LabelType |
Public Member Functions | |
BOOST_STATIC_CONSTANT (std::size_t, DefaultBatchSize=(LabeledData< InputT, LabelT >::DefaultBatchSize)) | |
WeightedLabeledData () | |
Empty data set. More... | |
WeightedLabeledData (std::size_t numBatches) | |
Create an empty set with just the correct number of batches. More... | |
WeightedLabeledData (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... | |
WeightedLabeledData (LabeledData< InputType, LabelType > const &data, Data< WeightType > const &weights) | |
Construction from data. More... | |
WeightedLabeledData (LabeledData< InputType, LabelType > const &data, double weight) | |
Construction from data and a constant weight for all elements. More... | |
UnlabeledData< InputType > const & | inputs () const |
Access to the inputs as a separate container. More... | |
UnlabeledData< InputType > & | inputs () |
Access to the inputs as a separate container. More... | |
Data< LabelType > const & | labels () const |
Access to the labels as a separate container. More... | |
Data< LabelType > & | labels () |
Access to the labels as a separate container. More... | |
Shape const & | inputShape () const |
Returns the Shape of the inputs. More... | |
Shape & | inputShape () |
Returns the Shape of the inputs. More... | |
Shape const & | labelShape () const |
Returns the Shape of the labels. More... | |
Shape & | labelShape () |
Returns the Shape of the labels. More... | |
WeightedUnlabeledData< InputType > | weightedInputs () const |
Constructs an WeightedUnlabeledData object for the inputs. More... | |
WeightedLabeledData | 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 (WeightedLabeledData &a, WeightedLabeledData &b) |
Weighted data set for supervised learning.
The WeightedLabeledData class extends LabeledData for the representation of data. In addition it holds and provides access to the corresponding weights.
WeightedLabeledData tries to mimic the underlying data as pairs of data tuples(input,label) and weights. this means that when accessing a batch by calling batch(i) or choosing one of the iterators one access the databatch by batch(i).data and the weights by batch(i).weight. to access the points and labels use batch(i).data.input and batch(i).data.label
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.
It is possible to gains everal views on the set. one can either get access to inputs, labels and weights separately or gain access to the unweighted dataset of inputs and labels. Additionally the sets support on-the-fly creation of the (inputs,weights) subset for unsupervised weighted learning
Definition at line 578 of file WeightedDataset.h.
typedef base_type::DataType shark::WeightedLabeledData< InputT, LabelT >::DataType |
Definition at line 583 of file WeightedDataset.h.
typedef InputT shark::WeightedLabeledData< InputT, LabelT >::InputType |
Definition at line 585 of file WeightedDataset.h.
typedef LabelT shark::WeightedLabeledData< InputT, LabelT >::LabelType |
Definition at line 586 of file WeightedDataset.h.
typedef base_type::WeightType shark::WeightedLabeledData< InputT, LabelT >::WeightType |
Definition at line 584 of file WeightedDataset.h.
|
inline |
Empty data set.
Definition at line 597 of file WeightedDataset.h.
|
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 603 of file WeightedDataset.h.
|
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
size | the new size of the container |
element | the blueprint element from which to create the Container |
batchSize | the size of the batches. if this is 0, the size is unlimited |
Definition at line 614 of file WeightedDataset.h.
|
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 621 of file WeightedDataset.h.
|
inline |
Construction from data and a constant weight for all elements.
Definition at line 626 of file WeightedDataset.h.
shark::WeightedLabeledData< InputT, LabelT >::BOOST_STATIC_CONSTANT | ( | std::size_t | , |
DefaultBatchSize | = (LabeledData< InputT, LabelT >::DefaultBatchSize) |
||
) |
|
inline |
Access to the inputs as a separate container.
Definition at line 631 of file WeightedDataset.h.
References shark::WeightedDataPair< DataType, WeightType >::data.
Referenced by shark::inputDimension(), shark::RFTrainer< unsigned int >::train(), shark::RFTrainer< RealVector >::train(), and shark::CSvmTrainer< InputType, CacheType >::train().
|
inline |
Access to the inputs as a separate container.
Definition at line 635 of file WeightedDataset.h.
References shark::WeightedDataPair< DataType, WeightType >::data.
|
inline |
Returns the Shape of the inputs.
Definition at line 649 of file WeightedDataset.h.
Referenced by shark::bootstrap().
|
inline |
Returns the Shape of the inputs.
Definition at line 654 of file WeightedDataset.h.
|
inline |
Access to the labels as a separate container.
Definition at line 640 of file WeightedDataset.h.
References shark::WeightedDataPair< DataType, WeightType >::data.
Referenced by shark::classSizes(), shark::labelDimension(), shark::numberOfClasses(), shark::RFTrainer< unsigned int >::train(), and shark::RFTrainer< RealVector >::train().
|
inline |
Access to the labels as a separate container.
Definition at line 644 of file WeightedDataset.h.
References shark::WeightedDataPair< DataType, WeightType >::data.
|
inline |
Returns the Shape of the labels.
Definition at line 659 of file WeightedDataset.h.
Referenced by shark::bootstrap().
|
inline |
Returns the Shape of the labels.
Definition at line 664 of file WeightedDataset.h.
|
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 677 of file WeightedDataset.h.
References shark::WeightedDataPair< DataType, WeightType >::data.
|
inline |
Constructs an WeightedUnlabeledData object for the inputs.
Definition at line 669 of file WeightedDataset.h.
References shark::WeightedDataPair< DataType, WeightType >::data.
|
friend |
Definition at line 681 of file WeightedDataset.h.