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... | |
WeightedUnlabeledData< InputType > | weightedInputs () const |
Constructs an WeightedUnlabeledData object for the inputs. More... | |
self_type | 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 (self_type &a, self_type &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 456 of file WeightedDataset.h.
typedef base_type::DataType shark::WeightedLabeledData< InputT, LabelT >::DataType |
Definition at line 462 of file WeightedDataset.h.
typedef InputT shark::WeightedLabeledData< InputT, LabelT >::InputType |
Definition at line 464 of file WeightedDataset.h.
typedef LabelT shark::WeightedLabeledData< InputT, LabelT >::LabelType |
Definition at line 465 of file WeightedDataset.h.
typedef base_type::WeightType shark::WeightedLabeledData< InputT, LabelT >::WeightType |
Definition at line 463 of file WeightedDataset.h.
|
inline |
Empty data set.
Definition at line 476 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 482 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 493 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 500 of file WeightedDataset.h.
|
inline |
Construction from data and a constant weight for all elements.
Definition at line 505 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 510 of file WeightedDataset.h.
References shark::UnlabeledData< InputT >::inputs().
Referenced by shark::inputDimension(), and shark::CSvmTrainer< InputType, CacheType >::train().
|
inline |
Access to the inputs as a separate container.
Definition at line 514 of file WeightedDataset.h.
References shark::UnlabeledData< InputT >::inputs().
|
inline |
Access to the labels as a separate container.
Definition at line 519 of file WeightedDataset.h.
Referenced by shark::classSizes(), shark::labelDimension(), shark::numberOfClasses(), and shark::CSvmTrainer< InputType, CacheType >::train().
|
inline |
Access to the labels as a separate container.
Definition at line 523 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 536 of file WeightedDataset.h.
|
inline |
Constructs an WeightedUnlabeledData object for the inputs.
Definition at line 528 of file WeightedDataset.h.
Definition at line 540 of file WeightedDataset.h.