SG++
sgpp::datadriven::SortedDataset Class Reference

Dataset that can be ordered. Accessing the included DataMatrix might invalidate the order. More...

#include <SortedDataset.hpp>

Inheritance diagram for sgpp::datadriven::SortedDataset:
sgpp::datadriven::Dataset

Public Types

enum  OrderType {
  None, External, Random, Morton,
  Invalid
}
 Available permutations. More...
 

Public Member Functions

sgpp::base::DataMatrixgetData ()
 Sets the OrderType to OrderType::Invalid. More...
 
OrderType getOrderType () const
 Returns current order type. More...
 
void restoreOrder ()
 Restores the original order in case of a valid order type. Sets ot to OrderType::None. More...
 
void setOrder (OrderType order)
 Sets the order for the dataset and rearranges the data. More...
 
void setOrder (const std::vector< size_t > &permutation)
 Reorders the data with a given permutation. More...
 
 SortedDataset ()
 Constructs an empty dataset (zero size). More...
 
 SortedDataset (size_t numberInstances, size_t dimension)
 Constructs an empty dataset with given size. More...
 
 SortedDataset (const Dataset &src)
 Constructs a copy of a dataset. More...
 
- Public Member Functions inherited from sgpp::datadriven::Dataset
 Dataset ()
 Constructs an empty dataset (zero size). More...
 
 Dataset (size_t numberInstances, size_t dimension)
 Constructs an empty dataset with given size. More...
 
sgpp::base::DataMatrixgetData ()
 
const sgpp::base::DataMatrixgetData () const
 
size_t getDimension () const
 
size_t getNumberInstances () const
 
sgpp::base::DataVectorgetTargets ()
 
const sgpp::base::DataVectorgetTargets () const
 

Protected Member Functions

void usePermutation ()
 uses the permutation on the DataMatrix and the DataVector More...
 

Protected Attributes

OrderType ot
 
std::vector< size_t > perm
 
- Protected Attributes inherited from sgpp::datadriven::Dataset
sgpp::base::DataMatrix data
 
size_t dimension
 
size_t numberInstances
 
sgpp::base::DataVector targets
 

Detailed Description

Dataset that can be ordered. Accessing the included DataMatrix might invalidate the order.

Member Enumeration Documentation

Available permutations.

Enumerator
None 
External 
Random 
Morton 
Invalid 

Constructor & Destructor Documentation

sgpp::datadriven::SortedDataset::SortedDataset ( )

Constructs an empty dataset (zero size).

References ot.

sgpp::datadriven::SortedDataset::SortedDataset ( size_t  numberInstances,
size_t  dimension 
)

Constructs an empty dataset with given size.

Parameters
numberInstancesnumber of instances in the dataset
dimensionnumber of dimensions in the dataset

References ot.

sgpp::datadriven::SortedDataset::SortedDataset ( const Dataset src)
explicit

Constructs a copy of a dataset.

References sgpp::datadriven::Dataset::getNumberInstances(), and ot.

Member Function Documentation

sgpp::base::DataMatrix & sgpp::datadriven::SortedDataset::getData ( )

Sets the OrderType to OrderType::Invalid.

Returns
training data of the dataset

References sgpp::datadriven::Dataset::getData(), and ot.

SortedDataset::OrderType sgpp::datadriven::SortedDataset::getOrderType ( ) const

Returns current order type.

References ot.

void sgpp::datadriven::SortedDataset::restoreOrder ( )

Restores the original order in case of a valid order type. Sets ot to OrderType::None.

References sgpp::datadriven::Dataset::data, sgpp::base::DataMatrix::getNcols(), ot, and sgpp::datadriven::Dataset::targets.

void sgpp::datadriven::SortedDataset::setOrder ( OrderType  order)

Sets the order for the dataset and rearranges the data.

The order is unchanged in case of OrderType::External. OrderType::None creates the identity permutation.

The order is unchanged in case of OrderType::External.

References sgpp::datadriven::Dataset::numberInstances, ot, and usePermutation().

void sgpp::datadriven::SortedDataset::setOrder ( const std::vector< size_t > &  permutation)

Reorders the data with a given permutation.

Sets the order type to OrderType::External If the permutation is invalid due to a size or index mismatch, ot is set to OrderType::Invalid. The i-th data value is permuted to the permutation[i]-th position.

References python.uq.tools::check(), python.uq.operations.sparse_grid::isValid(), sgpp::datadriven::Dataset::numberInstances, ot, and usePermutation().

void sgpp::datadriven::SortedDataset::usePermutation ( )
protected

uses the permutation on the DataMatrix and the DataVector

References sgpp::datadriven::Dataset::data, sgpp::base::DataMatrix::getNcols(), and sgpp::datadriven::Dataset::targets.

Referenced by setOrder().

Member Data Documentation

OrderType sgpp::datadriven::SortedDataset::ot
protected
std::vector<size_t> sgpp::datadriven::SortedDataset::perm
protected

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