Several mathematical, linear-algebra, or other functions within Shark are not part of any particular class. They are collected here in the doxygen group "shark_globals".
enum | shark::LabelPosition { shark::FIRST_COLUMN , shark::LAST_COLUMN } |
Position of the label in a CSV file. More... | |
SHARK_EXPORT_SYMBOL void | shark::csvStringToData (Data< FloatVector > &data, std::string const &contents, char separator=',', char comment='#', std::size_t maximumBatchSize=Data< RealVector >::DefaultBatchSize) |
Import unlabeled vectors from a read-in character-separated value file. | |
SHARK_EXPORT_SYMBOL void | shark::csvStringToData (Data< RealVector > &data, std::string const &contents, char separator=',', char comment='#', std::size_t maximumBatchSize=Data< RealVector >::DefaultBatchSize) |
Import unlabeled vectors from a read-in character-separated value file. | |
SHARK_EXPORT_SYMBOL void | shark::csvStringToData (Data< unsigned int > &data, std::string const &contents, char separator=',', char comment='#', std::size_t maximumBatchSize=Data< unsigned int >::DefaultBatchSize) |
Import "csv" from string consisting only of a single unsigned int per row. | |
SHARK_EXPORT_SYMBOL void | shark::csvStringToData (Data< int > &data, std::string const &contents, char separator=',', char comment='#', std::size_t maximumBatchSize=Data< int >::DefaultBatchSize) |
Import "csv" from string consisting only of a single int per row. | |
SHARK_EXPORT_SYMBOL void | shark::csvStringToData (Data< float > &data, std::string const &contents, char separator=',', char comment='#', std::size_t maximumBatchSize=Data< double >::DefaultBatchSize) |
Import "csv" from string consisting only of a single double per row. | |
SHARK_EXPORT_SYMBOL void | shark::csvStringToData (Data< double > &data, std::string const &contents, char separator=',', char comment='#', std::size_t maximumBatchSize=Data< double >::DefaultBatchSize) |
Import "csv" from string consisting only of a single double per row. | |
SHARK_EXPORT_SYMBOL void | shark::csvStringToData (LabeledData< RealVector, unsigned int > &dataset, std::string const &contents, LabelPosition lp, char separator=',', char comment='#', std::size_t maximumBatchSize=LabeledData< RealVector, unsigned int >::DefaultBatchSize) |
Import labeled data from a character-separated value file. | |
SHARK_EXPORT_SYMBOL void | shark::csvStringToData (LabeledData< FloatVector, unsigned int > &dataset, std::string const &contents, LabelPosition lp, char separator=',', char comment='#', std::size_t maximumBatchSize=LabeledData< RealVector, unsigned int >::DefaultBatchSize) |
Import labeled data from a character-separated value file. | |
SHARK_EXPORT_SYMBOL void | shark::csvStringToData (LabeledData< RealVector, RealVector > &dataset, std::string const &contents, LabelPosition lp, std::size_t numberOfOutputs=1, char separator=',', char comment='#', std::size_t maximumBatchSize=LabeledData< RealVector, RealVector >::DefaultBatchSize) |
Import regression data from a read-in character-separated value file. | |
SHARK_EXPORT_SYMBOL void | shark::csvStringToData (LabeledData< FloatVector, FloatVector > &dataset, std::string const &contents, LabelPosition lp, std::size_t numberOfOutputs=1, char separator=',', char comment='#', std::size_t maximumBatchSize=LabeledData< RealVector, RealVector >::DefaultBatchSize) |
Import regression data from a read-in character-separated value file. | |
template<class T > | |
void | shark::importCSV (Data< T > &data, std::string fn, char separator=',', char comment='#', std::size_t maximumBatchSize=Data< T >::DefaultBatchSize, std::size_t titleLines=0) |
Import a Dataset from a csv file. | |
template<class T > | |
void | shark::importCSV (LabeledData< blas::vector< T >, unsigned int > &data, std::string fn, LabelPosition lp, char separator=',', char comment='#', std::size_t maximumBatchSize=LabeledData< RealVector, unsigned int >::DefaultBatchSize) |
Import a labeled Dataset from a csv file. | |
template<class T > | |
void | shark::importCSV (LabeledData< blas::vector< T >, blas::vector< T > > &data, std::string fn, LabelPosition lp, std::size_t numberOfOutputs=1, char separator=',', char comment='#', std::size_t maximumBatchSize=LabeledData< RealVector, RealVector >::DefaultBatchSize) |
Import a labeled Dataset from a csv file. | |
template<typename Type > | |
void | shark::exportCSV (Data< Type > const &set, std::string fn, char separator=',', bool sci=true, unsigned int width=0) |
Format unlabeled data into a character-separated value file. | |
template<typename InputType , typename LabelType > | |
void | shark::exportCSV (LabeledData< InputType, LabelType > const &dataset, std::string fn, LabelPosition lp, char separator=',', bool sci=true, unsigned int width=0) |
Format labeled data into a character-separated value file. | |
enum | shark::KernelMatrixNormalizationType { shark::NONE , shark::MULTIPLICATIVE_TRACE_ONE , shark::MULTIPLICATIVE_TRACE_N , shark::MULTIPLICATIVE_VARIANCE_ONE , shark::CENTER_ONLY , shark::CENTER_AND_MULTIPLICATIVE_TRACE_ONE } |
template<typename InputType , typename LabelType > | |
void | shark::exportKernelMatrix (LabeledData< InputType, LabelType > const &dataset, AbstractKernelFunction< InputType > &kernel, std::ostream &out, KernelMatrixNormalizationType normalizer=NONE, bool scientific=false, unsigned int fieldwidth=0) |
Write a kernel Gram matrix to stream. | |
template<typename InputType , typename LabelType > | |
void | shark::exportKernelMatrix (LabeledData< InputType, LabelType > const &dataset, AbstractKernelFunction< InputType > &kernel, std::string fn, KernelMatrixNormalizationType normalizer=NONE, bool sci=false, unsigned int width=0) |
Write a kernel Gram matrix to file. | |
template<typename InputType , typename LabelType > | |
void | shark::export_kernel_matrix (LabeledData< InputType, LabelType > const &dataset, AbstractKernelFunction< InputType > &kernel, std::ostream &out, KernelMatrixNormalizationType normalizer=NONE, bool scientific=false, unsigned int fieldwidth=0) |
template<typename InputType , typename LabelType > | |
void | shark::export_kernel_matrix (LabeledData< InputType, LabelType > const &dataset, AbstractKernelFunction< InputType > &kernel, std::string fn, KernelMatrixNormalizationType normalizer=NONE, bool sci=false, unsigned int width=0) |
template<class I , class L > | |
CVFolds< LabeledData< I, L > > | shark::createCVIID (LabeledData< I, L > &set, std::size_t numberOfPartitions, std::size_t batchSize=Data< I >::DefaultBatchSize) |
Create a partition for cross validation. | |
template<class I , class L > | |
CVFolds< LabeledData< I, L > > | shark::createCVSameSize (LabeledData< I, L > &set, std::size_t numberOfPartitions, std::size_t batchSize=LabeledData< I, L >::DefaultBatchSize) |
Create a partition for cross validation. | |
template<class I > | |
CVFolds< LabeledData< I, unsigned int > > | shark::createCVSameSizeBalanced (LabeledData< I, unsigned int > &set, std::size_t numberOfPartitions, std::size_t batchSize=Data< I >::DefaultBatchSize, RecreationIndices *cv_indices=NULL) |
Create a partition for cross validation. | |
template<class I , class L > | |
CVFolds< LabeledData< I, L > > | shark::createCVBatch (LabeledData< I, L > const &set, std::size_t numberOfPartitions) |
Create a partition for cross validation without changing the dataset. | |
template<class I , class L > | |
CVFolds< LabeledData< I, L > > | shark::createCVIndexed (LabeledData< I, L > &set, std::size_t numberOfPartitions, std::vector< std::size_t > indices, std::size_t batchSize=Data< I >::DefaultBatchSize) |
Create a partition for cross validation from indices. | |
template<class I , class L > | |
CVFolds< LabeledData< I, L > > | shark::createCVFullyIndexed (LabeledData< I, L > &set, std::size_t numberOfPartitions, RecreationIndices indices, std::size_t batchSize=Data< I >::DefaultBatchSize) |
Create a partition for cross validation from indices for both ordering and partitioning. | |
template<class T > | |
std::ostream & | shark::operator<< (std::ostream &stream, const Data< T > &d) |
Outstream of elements. | |
template<class DatasetType , class IndexRange > | |
DataView< DatasetType > | shark::subset (DataView< DatasetType > const &view, IndexRange const &indizes) |
Creates a subset of a DataView with elements indexed by indices. | |
template<class DatasetType > | |
DataView< DatasetType > | shark::randomSubset (DataView< DatasetType > const &view, std::size_t size) |
creates a random subset of a DataView with given size | |
template<class DatasetType , class IndexRange > | |
DataView< DatasetType >::batch_type | shark::subBatch (DataView< DatasetType > const &view, IndexRange const &indizes) |
Creates a batch given a set of indices. | |
template<class DatasetType > | |
DataView< DatasetType >::batch_type | shark::randomSubBatch (DataView< DatasetType > const &view, std::size_t size) |
Creates a random batch of a given size. | |
template<class DatasetType > | |
DataView< DatasetType > | shark::toView (DatasetType &set) |
Creates a View from a dataset. | |
template<class T > | |
DataView< T >::dataset_type | shark::toDataset (DataView< T > const &view, std::size_t batchSize=DataView< T >::dataset_type::DefaultBatchSize) |
Creates a new dataset from a View. | |
template<class DatasetType > | |
std::size_t | shark::numberOfClasses (DataView< DatasetType > const &view) |
template<class DatasetType > | |
std::size_t | shark::inputDimension (DataView< DatasetType > const &view) |
Return the input dimensionality of the labeled dataset represented by the view. | |
template<class DatasetType > | |
std::size_t | shark::labelDimension (DataView< DatasetType > const &view) |
Return the label dimensionality of the labeled dataset represented by the view. | |
template<class DatasetType > | |
std::size_t | shark::dataDimension (DataView< DatasetType > const &view) |
Return the dimensionality of the dataset represented by the view. | |
SHARK_EXPORT_SYMBOL std::tuple< bool, std::string, std::string > | shark::splitUrl (std::string const &url) |
Split a URL into its domain and resource parts. | |
SHARK_EXPORT_SYMBOL std::string | shark::download (std::string const &url, unsigned short port=80) |
Download a document with the HTTP protocol. | |
template<class InputType , class LabelType > | |
void | shark::downloadSparseData (LabeledData< InputType, LabelType > &dataset, std::string const &url, unsigned short port=80, unsigned int highestIndex=0, std::size_t batchSize=LabeledData< RealVector, unsigned int >::DefaultBatchSize) |
Download and import a sparse data (libSVM) file. | |
template<class InputType > | |
void | shark::downloadCsvData (LabeledData< InputType, unsigned int > &dataset, std::string const &url, LabelPosition lp, char separator=',', char comment='#', unsigned short port=80, std::size_t maximumBatchSize=LabeledData< RealVector, RealVector >::DefaultBatchSize) |
Download and import a dense data (CSV) file for classification. | |
template<class InputType > | |
void | shark::downloadCsvData (LabeledData< InputType, RealVector > &dataset, std::string const &url, LabelPosition lp, std::size_t numberOfOutputs=1, char separator=',', char comment='#', unsigned short port=80, std::size_t maximumBatchSize=LabeledData< RealVector, RealVector >::DefaultBatchSize) |
Download and import a dense data (CSV) file for regression. | |
void | shark::import_libsvm (LabeledData< RealVector, unsigned int > &dataset, std::istream &stream, unsigned int highestIndex=0, std::size_t batchSize=LabeledData< RealVector, unsigned int >::DefaultBatchSize) |
Import data from a LIBSVM file. | |
void | shark::import_libsvm (LabeledData< CompressedRealVector, unsigned int > &dataset, std::istream &stream, unsigned int highestIndex=0, std::size_t batchSize=LabeledData< RealVector, unsigned int >::DefaultBatchSize) |
Import data from a LIBSVM file. | |
void | shark::import_libsvm (LabeledData< RealVector, unsigned int > &dataset, std::string fn, unsigned int highestIndex=0, std::size_t batchSize=LabeledData< RealVector, unsigned int >::DefaultBatchSize) |
Import data from a LIBSVM file. | |
void | shark::import_libsvm (LabeledData< CompressedRealVector, unsigned int > &dataset, std::string fn, unsigned int highestIndex=0, std::size_t batchSize=LabeledData< RealVector, unsigned int >::DefaultBatchSize) |
Import data from a LIBSVM file. | |
template<typename InputType > | |
void | shark::export_libsvm (LabeledData< InputType, unsigned int > &dataset, const std::string &fn, bool dense=false, bool oneMinusOne=true, bool sortLabels=false, bool append=false) |
Export data to LIBSVM format. | |
SHARK_EXPORT_SYMBOL void | shark::importSparseData (LabeledData< RealVector, unsigned int > &dataset, std::istream &stream, unsigned int highestIndex=0, std::size_t batchSize=LabeledData< RealVector, unsigned int >::DefaultBatchSize) |
Import classification data from a sparse data (libSVM) file. | |
SHARK_EXPORT_SYMBOL void | shark::importSparseData (LabeledData< FloatVector, unsigned int > &dataset, std::istream &stream, unsigned int highestIndex=0, std::size_t batchSize=LabeledData< RealVector, unsigned int >::DefaultBatchSize) |
SHARK_EXPORT_SYMBOL void | shark::importSparseData (LabeledData< RealVector, RealVector > &dataset, std::istream &stream, unsigned int highestIndex=0, std::size_t batchSize=LabeledData< RealVector, RealVector >::DefaultBatchSize) |
Import regression data from a sparse data (libSVM) file. | |
SHARK_EXPORT_SYMBOL void | shark::importSparseData (LabeledData< FloatVector, FloatVector > &dataset, std::istream &stream, unsigned int highestIndex=0, std::size_t batchSize=LabeledData< RealVector, RealVector >::DefaultBatchSize) |
SHARK_EXPORT_SYMBOL void | shark::importSparseData (LabeledData< CompressedRealVector, unsigned int > &dataset, std::istream &stream, unsigned int highestIndex=0, std::size_t batchSize=LabeledData< RealVector, unsigned int >::DefaultBatchSize) |
Import classification data from a sparse data (libSVM) file. | |
SHARK_EXPORT_SYMBOL void | shark::importSparseData (LabeledData< CompressedFloatVector, unsigned int > &dataset, std::istream &stream, unsigned int highestIndex=0, std::size_t batchSize=LabeledData< RealVector, unsigned int >::DefaultBatchSize) |
SHARK_EXPORT_SYMBOL void | shark::importSparseData (LabeledData< CompressedRealVector, RealVector > &dataset, std::istream &stream, unsigned int highestIndex=0, std::size_t batchSize=LabeledData< RealVector, RealVector >::DefaultBatchSize) |
Import regression data from a sparse data (libSVM) file. | |
SHARK_EXPORT_SYMBOL void | shark::importSparseData (LabeledData< CompressedFloatVector, FloatVector > &dataset, std::istream &stream, unsigned int highestIndex=0, std::size_t batchSize=LabeledData< RealVector, RealVector >::DefaultBatchSize) |
SHARK_EXPORT_SYMBOL void | shark::importSparseData (LabeledData< RealVector, unsigned int > &dataset, std::string fn, unsigned int highestIndex=0, std::size_t batchSize=LabeledData< RealVector, unsigned int >::DefaultBatchSize) |
Import classification data from a sparse data (libSVM) file. | |
SHARK_EXPORT_SYMBOL void | shark::importSparseData (LabeledData< FloatVector, unsigned int > &dataset, std::string fn, unsigned int highestIndex=0, std::size_t batchSize=LabeledData< RealVector, unsigned int >::DefaultBatchSize) |
SHARK_EXPORT_SYMBOL void | shark::importSparseData (LabeledData< RealVector, RealVector > &dataset, std::string fn, unsigned int highestIndex=0, std::size_t batchSize=LabeledData< RealVector, RealVector >::DefaultBatchSize) |
Import regression data from a sparse data (libSVM) file. | |
SHARK_EXPORT_SYMBOL void | shark::importSparseData (LabeledData< FloatVector, FloatVector > &dataset, std::string fn, unsigned int highestIndex=0, std::size_t batchSize=LabeledData< RealVector, RealVector >::DefaultBatchSize) |
SHARK_EXPORT_SYMBOL void | shark::importSparseData (LabeledData< CompressedRealVector, unsigned int > &dataset, std::string fn, unsigned int highestIndex=0, std::size_t batchSize=LabeledData< RealVector, unsigned int >::DefaultBatchSize) |
Import classification data from a sparse data (libSVM) file. | |
SHARK_EXPORT_SYMBOL void | shark::importSparseData (LabeledData< CompressedFloatVector, unsigned int > &dataset, std::string fn, unsigned int highestIndex=0, std::size_t batchSize=LabeledData< RealVector, unsigned int >::DefaultBatchSize) |
SHARK_EXPORT_SYMBOL void | shark::importSparseData (LabeledData< CompressedRealVector, RealVector > &dataset, std::string fn, unsigned int highestIndex=0, std::size_t batchSize=LabeledData< RealVector, RealVector >::DefaultBatchSize) |
Import regression data from a sparse data (libSVM) file. | |
SHARK_EXPORT_SYMBOL void | shark::importSparseData (LabeledData< CompressedFloatVector, FloatVector > &dataset, std::string fn, unsigned int highestIndex=0, std::size_t batchSize=LabeledData< RealVector, RealVector >::DefaultBatchSize) |
template<typename InputType > | |
void | shark::exportSparseData (LabeledData< InputType, unsigned int > const &dataset, std::ostream &stream, bool oneMinusOne=true, bool sortLabels=false) |
Export classification data to sparse data (libSVM) format. | |
template<typename InputType > | |
void | shark::exportSparseData (LabeledData< InputType, unsigned int > const &dataset, const std::string &fn, bool oneMinusOne=true, bool sortLabels=false, bool append=false) |
Export classification data to sparse data (libSVM) format. | |
template<typename InputType > | |
void | shark::exportSparseData (LabeledData< InputType, RealVector > const &dataset, std::ostream &stream) |
Export regression data to sparse data (libSVM) format. | |
template<typename InputType > | |
void | shark::exportSparseData (LabeledData< InputType, RealVector > const &dataset, const std::string &fn, bool append=false) |
Export regression data to sparse data (libSVM) format. | |
template<class X , class R > | |
X::value_type | shark::blas::createHouseholderReflection (vector_expression< X, cpu_tag > const &x, vector_expression< R, cpu_tag > &reflection) |
Generates a Householder reflection from a vector to use with applyHouseholderLeft/Right. | |
template<class Mat , class R , class T , class Device > | |
void | shark::blas::applyHouseholderOnTheRight (matrix_expression< Mat, Device > &matrix, vector_expression< R, Device > const &reflection, T beta) |
template<class Mat , class R , class T , class Device > | |
void | shark::blas::applyHouseholderOnTheLeft (matrix_expression< Mat, Device > &matrix, vector_expression< R, Device > const &reflection, T const &beta) |
rotates a matrix using a householder reflection | |
template<class Mat , class R , class T , class Device > | |
void | shark::blas::applyHouseholderOnTheLeft (matrix_expression< Mat, Device > &&matrix, vector_expression< R, Device > const &reflection, T const &beta) |
rotates a matrix using a householder reflection | |
template<class MatrixT > | |
void | shark::blas::randomRotationMatrix (random::rng_type &rng, matrix_container< MatrixT, cpu_tag > &matrixC) |
Initializes a matrix such that it forms a random rotation matrix. | |
RealMatrix | shark::blas::randomRotationMatrix (random::rng_type &rng, size_t size) |
Creates a random rotation matrix with a certain size using the random number generator rng. | |
template<class InputType , class OutputType , class ParameterVectorType > | |
void | shark::initRandomNormal (AbstractModel< InputType, OutputType, ParameterVectorType > &model, double s) |
Initialize model parameters normally distributed. | |
template<class InputType , class OutputType , class ParameterVectorType > | |
void | shark::initRandomUniform (AbstractModel< InputType, OutputType, ParameterVectorType > &model, double lower, double upper) |
Initialize model parameters uniformly at random. | |
Namespaces | |
namespace | shark |
AbstractMultiObjectiveOptimizer. | |
Functions | |
template<class T > | |
T | shark::maxExpInput () |
Maximum allowed input value for exp. | |
template<class T > | |
T | shark::minExpInput () |
Minimum value for exp(x) allowed so that it is not 0. | |
template<class T > | |
boost::enable_if< std::is_arithmetic< T >, T >::type | shark::sqr (const T &x) |
Calculates x^2. | |
template<class T > | |
T | shark::cube (const T &x) |
Calculates x^3. | |
template<class T > | |
boost::enable_if< std::is_arithmetic< T >, T >::type | shark::sigmoid (T x) |
Logistic function/logistic function. | |
template<class T > | |
T | shark::safeExp (T x) |
Thresholded exp function, over- and underflow safe. | |
template<class T > | |
T | shark::safeLog (T x) |
Thresholded log function, over- and underflow safe. | |
template<class T > | |
boost::enable_if< std::is_arithmetic< T >, T >::type | shark::softPlus (T x) |
Numerically stable version of the function log(1+exp(x)). | |
double | shark::softPlus (double x) |
Numerically stable version of the function log(1+exp(x)). calculated with float precision to save some time. | |
template<class T > | |
T | shark::copySign (T x, T y) |
shark::Data< Type >::BOOST_STATIC_CONSTANT (std::size_t, DefaultBatchSize=256) | |
Defines the default batch size of the Container. | |
template<class T > | |
bool | shark::Data< Type >::operator== (const Data< T > &rhs) |
Two containers compare equal if they share the same data. | |
template<class T > | |
bool | shark::Data< Type >::operator!= (const Data< T > &rhs) |
Two containers compare unequal if they don't share the same data. | |
const_element_range | shark::Data< Type >::elements () const |
Returns the range of elements. | |
element_range | shark::Data< Type >::elements () |
Returns therange of elements. | |
const_batch_range | shark::Data< Type >::batches () const |
Returns the range of batches. | |
batch_range | shark::Data< Type >::batches () |
Returns the range of batches. | |
std::size_t | shark::Data< Type >::numberOfBatches () const |
Returns the number of batches of the set. | |
std::size_t | shark::Data< Type >::numberOfElements () const |
Returns the total number of elements. | |
Shape const & | shark::Data< Type >::shape () const |
Returns the shape of the elements in the dataset. | |
Shape & | shark::Data< Type >::shape () |
Returns the shape of the elements in the dataset. | |
bool | shark::Data< Type >::empty () const |
Check whether the set is empty. | |
element_reference | shark::Data< Type >::element (std::size_t i) |
const_element_reference | shark::Data< Type >::element (std::size_t i) const |
batch_reference | shark::Data< Type >::batch (std::size_t i) |
const_batch_reference | shark::Data< Type >::batch (std::size_t i) const |
shark::Data< Type >::Data () | |
Constructor which constructs an empty set. | |
shark::Data< Type >::Data (std::size_t numBatches) | |
Construct a dataset with empty batches. | |
shark::Data< Type >::Data (std::size_t size, element_type const &element, std::size_t batchSize=DefaultBatchSize) | |
Construction with size and a single element. | |
void | shark::Data< Type >::read (InArchive &archive) |
Read the component from the supplied archive. | |
void | shark::Data< Type >::write (OutArchive &archive) const |
Write the component to the supplied archive. | |
virtual void | shark::Data< Type >::makeIndependent () |
This method makes the vector independent of all siblings and parents. | |
void | shark::Data< Type >::splitBatch (std::size_t batch, std::size_t elementIndex) |
Data | shark::Data< Type >::splice (std::size_t batch) |
Splits the container into two independent parts. The front part remains in the container, the back part is returned. | |
void | shark::Data< Type >::append (Data const &other) |
Appends the contents of another data object to the end. | |
void | shark::Data< Type >::push_back (const_batch_reference batch) |
template<class Range > | |
void | shark::Data< Type >::repartition (Range const &batchSizes) |
Reorders the batch structure in the container to that indicated by the batchSizes vector. | |
std::vector< std::size_t > | shark::Data< Type >::getPartitioning () const |
Creates a vector with the batch sizes of every batch. | |
template<class Range > | |
void | shark::Data< Type >::reorderElements (Range const &indices) |
Reorders elements across batches. | |
void | shark::Data< Type >::indexedSubset (IndexSet const &indices, Data &subset, Data &complement) const |
Fill in the subset defined by the list of indices as well as its complement. | |
Data | shark::Data< Type >::indexedSubset (IndexSet const &indices) const |
shark::UnlabeledData< InputT >::UnlabeledData () | |
Constructor. | |
shark::UnlabeledData< InputT >::UnlabeledData (Data< InputT > const &points) | |
Construction from data. | |
shark::UnlabeledData< InputT >::UnlabeledData (std::size_t size, element_type const &element, std::size_t batchSize=base_type::DefaultBatchSize) | |
Construction with size and a single element. | |
shark::UnlabeledData< InputT >::UnlabeledData (std::size_t numBatches) | |
Create an empty set with just the correct number of batches. | |
shark::UnlabeledData< InputT >::UnlabeledData (UnlabeledData const &container, std::vector< std::size_t > batchSizes) | |
Construct a dataset with different batch sizes. it is a copy of the other dataset. | |
UnlabeledData | shark::UnlabeledData< InputT >::operator= (Data< InputT > const &data) |
we allow assignment from Data. | |
UnlabeledData & | shark::UnlabeledData< InputT >::inputs () |
Access to the base_type class as "inputs". | |
UnlabeledData const & | shark::UnlabeledData< InputT >::inputs () const |
Access to the base_type class as "inputs". | |
UnlabeledData | shark::UnlabeledData< InputT >::splice (std::size_t batch) |
Splits the container in two independent parts. The left part remains in the container, the right is stored as return type. | |
void | shark::UnlabeledData< InputT >::shuffle () |
shuffles all elements in the entire dataset (that is, also across the batches) | |
const_element_range | shark::LabeledData< InputT, LabelT >::elements () const |
Returns the range of elements. | |
element_range | shark::LabeledData< InputT, LabelT >::elements () |
Returns therange of elements. | |
const_batch_range | shark::LabeledData< InputT, LabelT >::batches () const |
Returns the range of batches. | |
batch_range | shark::LabeledData< InputT, LabelT >::batches () |
Returns the range of batches. | |
std::size_t | shark::LabeledData< InputT, LabelT >::numberOfBatches () const |
Returns the number of batches of the set. | |
std::size_t | shark::LabeledData< InputT, LabelT >::numberOfElements () const |
Returns the total number of elements. | |
bool | shark::LabeledData< InputT, LabelT >::empty () const |
Check whether the set is empty. | |
InputContainer const & | shark::LabeledData< InputT, LabelT >::inputs () const |
Access to inputs as a separate container. | |
InputContainer & | shark::LabeledData< InputT, LabelT >::inputs () |
Access to inputs as a separate container. | |
LabelContainer const & | shark::LabeledData< InputT, LabelT >::labels () const |
Access to labels as a separate container. | |
LabelContainer & | shark::LabeledData< InputT, LabelT >::labels () |
Access to labels as a separate container. | |
shark::LabeledData< InputT, LabelT >::LabeledData () | |
Empty data set. | |
shark::LabeledData< InputT, LabelT >::LabeledData (std::size_t numBatches) | |
Create an empty set with just the correct number of batches. | |
shark::LabeledData< InputT, LabelT >::LabeledData (std::size_t size, element_type const &element, std::size_t batchSize=DefaultBatchSize) | |
shark::LabeledData< InputT, LabelT >::LabeledData (Data< InputType > const &inputs, Data< LabelType > const &labels) | |
Construction from data. | |
element_reference | shark::LabeledData< InputT, LabelT >::element (std::size_t i) |
const_element_reference | shark::LabeledData< InputT, LabelT >::element (std::size_t i) const |
batch_reference | shark::LabeledData< InputT, LabelT >::batch (std::size_t i) |
const_batch_reference | shark::LabeledData< InputT, LabelT >::batch (std::size_t i) const |
Shape const & | shark::LabeledData< InputT, LabelT >::inputShape () const |
Returns the Shape of the inputs. | |
Shape & | shark::LabeledData< InputT, LabelT >::inputShape () |
Returns the Shape of the inputs. | |
Shape const & | shark::LabeledData< InputT, LabelT >::labelShape () const |
Returns the Shape of the labels. | |
Shape & | shark::LabeledData< InputT, LabelT >::labelShape () |
Returns the Shape of the labels. | |
void | shark::LabeledData< InputT, LabelT >::read (InArchive &archive) |
from ISerializable | |
void | shark::LabeledData< InputT, LabelT >::write (OutArchive &archive) const |
from ISerializable | |
virtual void | shark::LabeledData< InputT, LabelT >::makeIndependent () |
This method makes the vector independent of all siblings and parents. | |
void | shark::LabeledData< InputT, LabelT >::splitBatch (std::size_t batch, std::size_t elementIndex) |
LabeledData | shark::LabeledData< InputT, LabelT >::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. | |
void | shark::LabeledData< InputT, LabelT >::append (LabeledData const &other) |
Appends the contents of another data object to the end. | |
void | shark::LabeledData< InputT, LabelT >::push_back (typename Batch< InputType >::type const &inputs, typename Batch< LabelType >::type const &labels) |
void | shark::LabeledData< InputT, LabelT >::push_back (const_batch_reference batch) |
template<class Range > | |
void | shark::LabeledData< InputT, LabelT >::repartition (Range const &batchSizes) |
Reorders the batch structure in the container to that indicated by the batchSizes vector. | |
std::vector< std::size_t > | shark::LabeledData< InputT, LabelT >::getPartitioning () const |
Creates a vector with the batch sizes of every batch. | |
template<class Range > | |
void | shark::LabeledData< InputT, LabelT >::reorderElements (Range const &indices) |
void | shark::LabeledData< InputT, LabelT >::shuffle () |
shuffles all elements in the entire dataset (that is, also across the batches) | |
LabeledData | shark::LabeledData< InputT, LabelT >::indexedSubset (IndexSet const &indices) const |
Fill in the subset defined by the list of indices. | |
template<class Range > | |
Data< typename Range::value_type > | shark::createDataFromRange (Range const &inputs, std::size_t maximumBatchSize=0) |
creates a data object from a range of elements | |
template<class Range > | |
UnlabeledData< typename boost::range_value< Range >::type > | shark::createUnlabeledDataFromRange (Range const &inputs, std::size_t maximumBatchSize=0) |
creates a data object from a range of elements | |
template<class Range1 , class Range2 > | |
LabeledData< typename boost::range_value< Range1 >::type, typename boost::range_value< Range2 >::type > | shark::createLabeledDataFromRange (Range1 const &inputs, Range2 const &labels, std::size_t maximumBatchSize=0) |
creates a labeled data object from two ranges, representing inputs and labels | |
template<class T , class U > | |
std::ostream & | shark::operator<< (std::ostream &stream, const LabeledData< T, U > &d) |
brief Outstream of elements for labeled data. | |
unsigned int | shark::numberOfClasses (Data< unsigned int > const &labels) |
Return the number of classes of a set of class labels with unsigned int label encoding. | |
std::vector< std::size_t > | shark::classSizes (Data< unsigned int > const &labels) |
Returns the number of members of each class in the dataset. | |
template<class InputType > | |
std::size_t | shark::dataDimension (Data< InputType > const &dataset) |
Return the dimensionality of a dataset. | |
template<class InputType , class LabelType > | |
std::size_t | shark::inputDimension (LabeledData< InputType, LabelType > const &dataset) |
Return the input dimensionality of a labeled dataset. | |
template<class InputType , class LabelType > | |
std::size_t | shark::labelDimension (LabeledData< InputType, LabelType > const &dataset) |
Return the label/output dimensionality of a labeled dataset. | |
template<class InputType > | |
std::size_t | shark::numberOfClasses (LabeledData< InputType, unsigned int > const &dataset) |
Return the number of classes (highest label value +1) of a classification dataset with unsigned int label encoding. | |
template<class InputType , class LabelType > | |
std::vector< std::size_t > | shark::classSizes (LabeledData< InputType, LabelType > const &dataset) |
Returns the number of members of each class in the dataset. | |
template<class T , class Functor > | |
boost::lazy_disable_if< CanBeCalled< Functor, typenameData< T >::batch_type >, TransformedData< Functor, T > >::type | shark::transform (Data< T > const &data, Functor f) |
Transforms a dataset using a Functor f and returns the transformed result. | |
template<class T , class Functor > | |
boost::lazy_enable_if< CanBeCalled< Functor, typenameData< T >::batch_type >, TransformedData< Functor, T > >::type | shark::transform (Data< T > const &data, Functor const &f) |
Transforms a dataset using a Functor f and returns the transformed result. | |
template<class I , class L , class Functor > | |
LabeledData< typename detail::TransformedDataElement< Functor, I >::type, L > | shark::transformInputs (LabeledData< I, L > const &data, Functor const &f) |
Transforms the inputs of a dataset and return the transformed result. | |
template<class I , class L , class Functor > | |
LabeledData< I, typename detail::TransformedDataElement< Functor, L >::type > | shark::transformLabels (LabeledData< I, L > const &data, Functor const &f) |
Transforms the labels of a dataset and returns the transformed result. | |
template<class T , class FeatureSet > | |
Data< blas::vector< T > > | shark::selectFeatures (Data< blas::vector< T > > const &data, FeatureSet const &features) |
Creates a copy of a dataset selecting only a certain set of features. | |
template<class T , class FeatureSet > | |
LabeledData< RealVector, T > | shark::selectInputFeatures (LabeledData< RealVector, T > const &data, FeatureSet const &features) |
template<class DatasetT > | |
DatasetT | shark::splitAtElement (DatasetT &data, std::size_t elementIndex) |
Removes the last part of a given dataset and returns a new split containing the removed elements. | |
template<class I > | |
void | shark::repartitionByClass (LabeledData< I, unsigned int > &data, std::size_t batchSize=LabeledData< I, unsigned int >::DefaultBatchSize) |
reorders the dataset such, that points are grouped by labels | |
template<class I > | |
LabeledData< I, unsigned int > | shark::binarySubProblem (LabeledData< I, unsigned int >const &data, unsigned int zeroClass, unsigned int oneClass) |
template<class I > | |
LabeledData< I, unsigned int > | shark::oneVersusRestProblem (LabeledData< I, unsigned int >const &data, unsigned int oneClass) |
Construct a binary (two-class) one-versus-rest problem from a multi-class problem. | |
template<typename RowType > | |
RowType | shark::getColumn (Data< RowType > const &data, std::size_t columnID) |
template<typename RowType > | |
void | shark::setColumn (Data< RowType > &data, std::size_t columnID, RowType newColumn) |
template<class Type , class T > | |
Data< blas::vector< Type, blas::gpu_tag > > | shark::toGPU (Data< blas::vector< T, blas::cpu_tag > > const &data) |
Transfers a dataset from CPU to the GPU/OpenCL device. | |
template<class Type > | |
Data< blas::vector< Type, blas::gpu_tag > > | shark::toGPU (Data< unsigned int > const &data) |
Transfers a dataset from CPU to the GPU/OpenCL device. | |
template<class Type , class I , class L > | |
LabeledData< blas::vector< Type, blas::gpu_tag >, blas::vector< Type, blas::gpu_tag > > | shark::toGPU (LabeledData< I, L > const &data) |
Transfers a labeled dataset from CPU to the GPU/OpenCL device. | |
template<class T > | |
void | shark::importPGM (std::string const &fileName, T &data, std::size_t &sx, std::size_t &sy) |
Import a PGM image from file. | |
template<class T > | |
void | shark::exportPGM (std::string const &fileName, T const &data, std::size_t sx, std::size_t sy, bool normalize=false) |
Export a PGM image to file. | |
void | shark::exportFiltersToPGMGrid (std::string const &basename, RealMatrix const &filters, std::size_t width, std::size_t height) |
Exports a set of filters as a grid image. | |
void | shark::exportFiltersToPGMGrid (std::string const &basename, Data< RealVector > const &filters, std::size_t width, std::size_t height) |
Exports a set of filters as a grid image. | |
template<class T > | |
void | shark::importPGMSet (std::string const &p, Data< T > &set) |
Import PGM images scanning a directory recursively. | |
Variables | |
static const double | shark::SQRT_2_PI = boost::math::constants::root_two_pi<double>() |
Constant for sqrt( 2 * pi ). | |
Container | shark::Data< Type >::m_data |
data | |
Shape | shark::Data< Type >::m_shape |
shape of a datapoint | |
static const std::size_t | shark::LabeledData< InputT, LabelT >::DefaultBatchSize = InputContainer::DefaultBatchSize |
InputContainer | shark::LabeledData< InputT, LabelT >::m_data |
LabelContainer | shark::LabeledData< InputT, LabelT >::m_label |
point data | |
Friends | |
template<class InputT , class LabelT > | |
class | shark::Data< Type >::LabeledData |
void | shark::Data< Type >::swap (Data &a, Data &b) |
void | shark::LabeledData< InputT, LabelT >::swap (LabeledData &a, LabeledData &b) |
typedef detail::BatchRange<Data<Type> > shark::Data< Type >::batch_range |
typedef detail::BatchRange<LabeledData<InputType,LabelType> > shark::LabeledData< InputT, LabelT >::batch_range |
typedef batch_type& shark::Data< Type >::batch_reference |
typedef InputLabelBatch< typename Batch<InputType>::type&, typename Batch<LabelType>::type& > shark::LabeledData< InputT, LabelT >::batch_reference |
typedef detail::BatchRange<Data<Type> const> shark::Data< Type >::const_batch_range |
typedef detail::BatchRange<LabeledData<InputType,LabelType> const> shark::LabeledData< InputT, LabelT >::const_batch_range |
typedef batch_type const& shark::Data< Type >::const_batch_reference |
typedef InputLabelBatch< typename Batch<InputType>::type const&, typename Batch<LabelType>::type const& > shark::LabeledData< InputT, LabelT >::const_batch_reference |
typedef boost::iterator_range< detail::DataElementIterator<Data<Type> const> > shark::Data< Type >::const_element_range |
typedef boost::iterator_range< detail::DataElementIterator<LabeledData<InputType,LabelType> const> > shark::LabeledData< InputT, LabelT >::const_element_range |
typedef Batch<element_type>::const_reference shark::Data< Type >::const_element_reference |
typedef const_batch_reference::const_reference shark::LabeledData< InputT, LabelT >::const_element_reference |
|
protected |
typedef boost::iterator_range< detail::DataElementIterator<Data<Type> > > shark::Data< Type >::element_range |
typedef boost::iterator_range< detail::DataElementIterator<LabeledData<InputType,LabelType> > > shark::LabeledData< InputT, LabelT >::element_range |
typedef Batch<element_type>::reference shark::Data< Type >::element_reference |
typedef batch_reference::reference shark::LabeledData< InputT, LabelT >::element_reference |
typedef std::vector<std::size_t> shark::Data< Type >::IndexSet |
typedef InputContainer::IndexSet shark::LabeledData< InputT, LabelT >::IndexSet |
typedef detail::SharedContainer<InputT> shark::UnlabeledData< InputT >::InputContainer |
typedef UnlabeledData<InputT> shark::LabeledData< InputT, LabelT >::InputContainer |
typedef element_type shark::UnlabeledData< InputT >::InputType |
typedef InputT shark::LabeledData< InputT, LabelT >::InputType |
typedef Data<LabelT> shark::LabeledData< InputT, LabelT >::LabelContainer |
typedef LabelT shark::LabeledData< InputT, LabelT >::LabelType |
Enumerator | |
---|---|
NONE | |
MULTIPLICATIVE_TRACE_ONE | |
MULTIPLICATIVE_TRACE_N | |
MULTIPLICATIVE_VARIANCE_ONE | |
CENTER_ONLY | |
CENTER_AND_MULTIPLICATIVE_TRACE_ONE |
Definition at line 57 of file ExportKernelMatrix.h.
enum shark::LabelPosition |
|
inline |
Appends the contents of another data object to the end.
The batches are not copied but now referenced from both datasets. Thus changing the appended dataset might change this one as well.
Definition at line 305 of file Dataset.h.
References shark::Data< Type >::m_data.
Referenced by shark::LabeledData< InputT, LabelT >::append().
|
inline |
Appends the contents of another data object to the end.
The batches are not copied but now referenced from both datasets. Thus changing the appended dataset might change this one as well.
Definition at line 712 of file Dataset.h.
References shark::Data< Type >::append(), shark::LabeledData< InputT, LabelT >::m_data, and shark::LabeledData< InputT, LabelT >::m_label.
Referenced by shark::SvmLogisticInterpretation< InputType >::eval().
void shark::blas::applyHouseholderOnTheLeft | ( | matrix_expression< Mat, Device > && | matrix, |
vector_expression< R, Device > const & | reflection, | ||
T const & | beta | ||
) |
rotates a matrix using a householder reflection
calculates (1-beta*xx^T)*A
Definition at line 137 of file rotations.h.
References shark::blas::applyHouseholderOnTheLeft().
void shark::blas::applyHouseholderOnTheLeft | ( | matrix_expression< Mat, Device > & | matrix, |
vector_expression< R, Device > const & | reflection, | ||
T const & | beta | ||
) |
rotates a matrix using a householder reflection
calculates (1-beta*xx^T)*A
Definition at line 112 of file rotations.h.
References SIZE_CHECK.
Referenced by shark::blas::applyHouseholderOnTheLeft(), and shark::blas::randomRotationMatrix().
void shark::blas::applyHouseholderOnTheRight | ( | matrix_expression< Mat, Device > & | matrix, |
vector_expression< R, Device > const & | reflection, | ||
T | beta | ||
) |
Definition at line 85 of file rotations.h.
References SIZE_CHECK.
|
inline |
Definition at line 240 of file Dataset.h.
References shark::Data< Type >::m_data.
Referenced by shark::LabeledData< InputT, LabelT >::batch(), shark::LabeledData< InputT, LabelT >::batch(), shark::calculateKernelMatrixParameterDerivative(), shark::calculateMixedKernelMatrix(), shark::calculateRegularizedKernelMatrix(), shark::classSizes(), shark::createDataFromRange(), shark::DifferenceKernelMatrix< InputType, CacheType >::entry(), shark::KernelExpansion< InputType >::eval(), shark::AbstractLoss< LabelT, OutputT >::eval(), shark::ZeroOneLoss< unsigned int, blas::vector< Float > >::eval(), shark::NegativeLogLikelihood::eval(), shark::VariationalAutoencoderError< SearchPointType >::eval(), shark::NegativeLogLikelihood::evalDerivative(), shark::ContrastiveDivergence< Operator >::evalDerivative(), shark::VariationalAutoencoderError< SearchPointType >::evalDerivative(), shark::exportFiltersToPGMGrid(), shark::LabeledData< InputT, LabelT >::LabeledData(), main(), shark::numberOfClasses(), shark::Data< Type >::push_back(), shark::Data< Type >::reorderElements(), shark::Data< Type >::splice(), shark::Data< Type >::splitBatch(), shark::toGPU(), shark::toGPU(), shark::NormalizeKernelUnitVariance< InputType >::train(), shark::transform(), and shark::transform().
|
inline |
Definition at line 648 of file Dataset.h.
References shark::Data< Type >::batch(), shark::LabeledData< InputT, LabelT >::m_data, and shark::LabeledData< InputT, LabelT >::m_label.
Referenced by shark::binarySubProblem(), shark::createCVFullyIndexed(), shark::createCVIndexed(), shark::KernelTargetAlignment< InputType, LabelType >::evalDerivative(), shark::exportSparseData(), shark::exportSparseData(), shark::SimpleNearestNeighbors< InputType, LabelType >::getNeighbors(), main(), shark::LabeledData< InputT, LabelT >::push_back(), shark::ROC::ROC(), shark::LabeledData< InputT, LabelT >::splice(), and shark::LabeledData< InputT, LabelT >::splitBatch().
|
inline |
Definition at line 243 of file Dataset.h.
References shark::Data< Type >::m_data.
|
inline |
Definition at line 651 of file Dataset.h.
References shark::Data< Type >::batch(), shark::LabeledData< InputT, LabelT >::m_data, and shark::LabeledData< InputT, LabelT >::m_label.
|
inline |
|
inline |
|
inline |
Returns the range of batches.
It is compatible to boost::range and STL and can be used whenever an algorithm requires element access via begin()/end() in which case data.elements() provides the correct interface
Definition at line 195 of file Dataset.h.
Referenced by shark::ExactGradient< RBMType >::evalDerivative(), main(), and shark::negativeLogLikelihoodFromLogPartition().
|
inline |
Returns the range of batches.
It is compatible to boost::range and STL and can be used whenever an algorithm requires element access via begin()/end() in which case data.elements() provides the correct interface
Definition at line 558 of file Dataset.h.
Referenced by shark::SvmLogisticInterpretation< InputType >::evalDerivative().
LabeledData< I, unsigned int > shark::binarySubProblem | ( | LabeledData< I, unsigned int >const & | data, |
unsigned int | zeroClass, | ||
unsigned int | oneClass | ||
) |
Definition at line 1077 of file Dataset.h.
References shark::LabeledData< InputT, LabelT >::batch(), shark::getBatchElement(), shark::LabeledData< InputT, LabelT >::indexedSubset(), shark::LabeledData< InputT, LabelT >::numberOfBatches(), SHARK_RUNTIME_CHECK, and shark::transformLabels().
Referenced by main().
shark::Data< Type >::BOOST_STATIC_CONSTANT | ( | std::size_t | , |
DefaultBatchSize | = 256 |
||
) |
Defines the default batch size of the Container.
Zero means: unlimited
|
inline |
Returns the number of members of each class in the dataset.
Definition at line 902 of file Dataset.h.
References shark::Data< Type >::batch(), shark::Data< Type >::numberOfBatches(), and shark::numberOfClasses().
Referenced by shark::classSizes(), shark::classSizes(), shark::classSizes(), main(), shark::repartitionByClass(), and shark::ROC::ROC().
|
inline |
Returns the number of members of each class in the dataset.
Definition at line 937 of file Dataset.h.
References shark::classSizes(), and shark::LabeledData< InputT, LabelT >::labels().
T shark::copySign | ( | T | x, |
T | y | ||
) |
CVFolds< LabeledData< I, L > > shark::createCVBatch | ( | LabeledData< I, L > const & | set, |
std::size_t | numberOfPartitions | ||
) |
Create a partition for cross validation without changing the dataset.
This method behaves similar to createCVIID with the difference that batches are not reordered. Thus the batches are only rearranged randomly in folds, but the dataset itself is not changed.
numberOfPartitions | number of partitions to create |
set | the input data from which to draw the partitions |
Definition at line 327 of file CVDatasetTools.h.
References shark::random::globalRng, shark::LabeledData< InputT, LabelT >::numberOfBatches(), and shark::shuffle().
CVFolds< LabeledData< I, L > > shark::createCVFullyIndexed | ( | LabeledData< I, L > & | set, |
std::size_t | numberOfPartitions, | ||
RecreationIndices | indices, | ||
std::size_t | batchSize = Data<I>::DefaultBatchSize |
||
) |
Create a partition for cross validation from indices for both ordering and partitioning.
Create a partition from indices. There is one index vector assigning an order to the samples, and another one assigning each sample to a validation partition. That is, given a dataset set, and at the i-th processing step, this function puts the order_indices[i]-th sample into the partition_indices[i]-th partition. The order_indices part of the above procedure matters if both an inner and outer partition are to be recreated: for the inner partition to be recreated, too, the outer partition must be recreated in the same order, not just partitioned into the same splits.
set | partitions will be subsets of this set |
numberOfPartitions | number of partitions to create |
indices | stores location index in the first and partition index in the second vector |
batchSize | maximum batch size |
Definition at line 427 of file CVDatasetTools.h.
References shark::LabeledData< InputT, LabelT >::batch(), shark::batchSize(), shark::LabeledData< InputT, LabelT >::numberOfElements(), SIZE_CHECK, shark::subBatch(), and shark::swap().
CVFolds< LabeledData< I, L > > shark::createCVIID | ( | LabeledData< I, L > & | set, |
std::size_t | numberOfPartitions, | ||
std::size_t | batchSize = Data<I>::DefaultBatchSize |
||
) |
Create a partition for cross validation.
The subset each training examples belongs to is drawn independently and uniformly distributed. For every partition, all but one subset form the training set, while the remaining one is used for validation. The partitions can be accessed using getCVPartitionName
set | the input data for which the new partitions are created |
numberOfPartitions | number of partitions to create |
batchSize | maximum batch size |
Definition at line 240 of file CVDatasetTools.h.
References shark::batchSize(), shark::createCVIndexed(), shark::random::discrete(), shark::random::globalRng, and shark::LabeledData< InputT, LabelT >::numberOfElements().
Referenced by main(), and run_one_trial().
CVFolds< LabeledData< I, L > > shark::createCVIndexed | ( | LabeledData< I, L > & | set, |
std::size_t | numberOfPartitions, | ||
std::vector< std::size_t > | indices, | ||
std::size_t | batchSize = Data<I>::DefaultBatchSize |
||
) |
Create a partition for cross validation from indices.
Create a partition from indices. The indices vector for each sample states of what validation partition that sample should become a member. In other words, the index maps a sample to a validation partition, meaning that it will become a part of the training partition for all other folds.
set | partitions will be subsets of this set |
numberOfPartitions | number of partitions to create |
indices | partition indices of the examples in [0, ..., numberOfPartitions[. |
batchSize | maximum batch size |
Definition at line 366 of file CVDatasetTools.h.
References shark::LabeledData< InputT, LabelT >::batch(), shark::batchSize(), shark::LabeledData< InputT, LabelT >::numberOfElements(), SIZE_CHECK, shark::subBatch(), and shark::swap().
Referenced by shark::createCVIID(), and main().
CVFolds< LabeledData< I, L > > shark::createCVSameSize | ( | LabeledData< I, L > & | set, |
std::size_t | numberOfPartitions, | ||
std::size_t | batchSize = LabeledData<I,L>::DefaultBatchSize |
||
) |
Create a partition for cross validation.
Every subset contains (approximately) the same number of elements. For every partition, all but one subset form the training set, while the remaining one is used for validation. The partitions can be accessed using getCVPartitionName
numberOfPartitions | number of partitions to create |
set | the input data from which to draw the partitions |
batchSize | maximum batch size |
Definition at line 261 of file CVDatasetTools.h.
References shark::batchSize(), shark::LabeledData< InputT, LabelT >::numberOfElements(), shark::LabeledData< InputT, LabelT >::repartition(), and shark::LabeledData< InputT, LabelT >::shuffle().
Referenced by main().
CVFolds< LabeledData< I, unsigned int > > shark::createCVSameSizeBalanced | ( | LabeledData< I, unsigned int > & | set, |
std::size_t | numberOfPartitions, | ||
std::size_t | batchSize = Data<I>::DefaultBatchSize , |
||
RecreationIndices * | cv_indices = NULL |
||
) |
Create a partition for cross validation.
Every subset contains (approximately) the same number of elements. For every partition, all but one subset form the training set, while the remaining one is used for validation.
numberOfPartitions | number of partitions to create |
set | the input data from which to draw the partitions |
batchSize | maximum batch size |
cv_indices | if not NULL [default]: for each element, store the fold it is assigned to; this can be used to later/externally recreate the fold via createCVIndexed |
Definition at line 298 of file CVDatasetTools.h.
References shark::batchSize(), shark::numberOfClasses(), and shark::DataView< DatasetType >::size().
Data< typename Range::value_type > shark::createDataFromRange | ( | Range const & | inputs, |
std::size_t | maximumBatchSize = 0 |
||
) |
creates a data object from a range of elements
Definition at line 825 of file Dataset.h.
References shark::Data< Type >::batch(), and shark::Data< Type >::shape().
Referenced by shark::BarsAndStripes::BarsAndStripes(), createData(), shark::createLabeledDataFromRange(), shark::createLabeledDataFromRange(), shark::createUnlabeledDataFromRange(), shark::createUnlabeledDataFromRange(), shark::importPGMSet(), main(), main(), and shark::Shifter::Shifter().
X::value_type shark::blas::createHouseholderReflection | ( | vector_expression< X, cpu_tag > const & | x, |
vector_expression< R, cpu_tag > & | reflection | ||
) |
Generates a Householder reflection from a vector to use with applyHouseholderLeft/Right.
Given a Vector x=(x0,x1,...,xn), finds a reflection with the property (c, 0,0,...0) = (I-beta v v^t)x and v = (x0-c,x1,x2,...,xn)
Definition at line 52 of file rotations.h.
References SIZE_CHECK.
LabeledData< typename boost::range_value< Range1 >::type, typename boost::range_value< Range2 >::type > shark::createLabeledDataFromRange | ( | Range1 const & | inputs, |
Range2 const & | labels, | ||
std::size_t | maximumBatchSize = 0 |
||
) |
creates a labeled data object from two ranges, representing inputs and labels
Definition at line 866 of file Dataset.h.
References shark::createDataFromRange(), and SHARK_RUNTIME_CHECK.
Referenced by shark::ProjectBudgetMaintenanceStrategy< RealVector >::addToModel(), shark::createLabeledDataFromRange(), createProblem(), shark::SvmLogisticInterpretation< InputType >::evalDerivative(), shark::LabeledDataDistribution< InputType, LabelType >::generateDataset(), and main().
UnlabeledData< typename boost::range_value< Range >::type > shark::createUnlabeledDataFromRange | ( | Range const & | inputs, |
std::size_t | maximumBatchSize = 0 |
||
) |
creates a data object from a range of elements
Definition at line 857 of file Dataset.h.
References shark::createDataFromRange().
Referenced by shark::createUnlabeledDataFromRange(), and shark::DataDistribution< InputType >::generateDataset().
SHARK_EXPORT_SYMBOL void shark::csvStringToData | ( | Data< double > & | data, |
std::string const & | contents, | ||
char | separator = ',' , |
||
char | comment = '#' , |
||
std::size_t | maximumBatchSize = Data< double >::DefaultBatchSize |
||
) |
Import "csv" from string consisting only of a single double per row.
data | Container storing the loaded data |
contents | The read in csv-file |
separator | Optional separator between entries, typically a comma, spaces ar automatically ignored |
comment | Trailing characters indicating comment line. By default it is "#" |
maximumBatchSize | Size of batches in the dataset |
SHARK_EXPORT_SYMBOL void shark::csvStringToData | ( | Data< float > & | data, |
std::string const & | contents, | ||
char | separator = ',' , |
||
char | comment = '#' , |
||
std::size_t | maximumBatchSize = Data< double >::DefaultBatchSize |
||
) |
Import "csv" from string consisting only of a single double per row.
data | Container storing the loaded data |
contents | The read in csv-file |
separator | Optional separator between entries, typically a comma, spaces ar automatically ignored |
comment | Trailing characters indicating comment line. By default it is "#" |
maximumBatchSize | Size of batches in the dataset |
SHARK_EXPORT_SYMBOL void shark::csvStringToData | ( | Data< FloatVector > & | data, |
std::string const & | contents, | ||
char | separator = ',' , |
||
char | comment = '#' , |
||
std::size_t | maximumBatchSize = Data< RealVector >::DefaultBatchSize |
||
) |
Import unlabeled vectors from a read-in character-separated value file.
data | Container storing the loaded data |
contents | The read in csv-file |
separator | Optional separator between entries, typically a comma, spaces ar automatically ignored |
comment | Trailing character indicating comment line. By dfault it is '#' |
maximumBatchSize | Size of batches in the dataset |
Referenced by shark::downloadCsvData(), shark::downloadCsvData(), shark::importCSV(), shark::importCSV(), and shark::importCSV().
SHARK_EXPORT_SYMBOL void shark::csvStringToData | ( | Data< int > & | data, |
std::string const & | contents, | ||
char | separator = ',' , |
||
char | comment = '#' , |
||
std::size_t | maximumBatchSize = Data< int >::DefaultBatchSize |
||
) |
Import "csv" from string consisting only of a single int per row.
data | Container storing the loaded data |
contents | The read in csv-file |
separator | Optional separator between entries, typically a comma, spaces ar automatically ignored |
comment | Trailing characters indicating comment line. By default it is "#" |
maximumBatchSize | Size of batches in the dataset |
SHARK_EXPORT_SYMBOL void shark::csvStringToData | ( | Data< RealVector > & | data, |
std::string const & | contents, | ||
char | separator = ',' , |
||
char | comment = '#' , |
||
std::size_t | maximumBatchSize = Data< RealVector >::DefaultBatchSize |
||
) |
Import unlabeled vectors from a read-in character-separated value file.
data | Container storing the loaded data |
contents | The read in csv-file |
separator | Optional separator between entries, typically a comma, spaces ar automatically ignored |
comment | Trailing character indicating comment line. By dfault it is '#' |
maximumBatchSize | Size of batches in the dataset |
SHARK_EXPORT_SYMBOL void shark::csvStringToData | ( | Data< unsigned int > & | data, |
std::string const & | contents, | ||
char | separator = ',' , |
||
char | comment = '#' , |
||
std::size_t | maximumBatchSize = Data< unsigned int >::DefaultBatchSize |
||
) |
Import "csv" from string consisting only of a single unsigned int per row.
data | Container storing the loaded data |
contents | The read in csv-file |
separator | Optional separator between entries, typically a comma, spaces ar automatically ignored |
comment | Trailing characters indicating comment line. By default it is "#" |
maximumBatchSize | Size of batches in the dataset |
SHARK_EXPORT_SYMBOL void shark::csvStringToData | ( | LabeledData< FloatVector, FloatVector > & | dataset, |
std::string const & | contents, | ||
LabelPosition | lp, | ||
std::size_t | numberOfOutputs = 1 , |
||
char | separator = ',' , |
||
char | comment = '#' , |
||
std::size_t | maximumBatchSize = LabeledData< RealVector, RealVector >::DefaultBatchSize |
||
) |
Import regression data from a read-in character-separated value file.
dataset | Container storing the loaded data |
contents | The read in csv-file |
lp | Position of the label in the record, either first or last column |
separator | Separator between entries, typically a comma or a space |
comment | Character for indicating a comment, by default empty |
numberOfOutputs | Dimensionality of label/output |
maximumBatchSize | maximum size of a batch in the dataset after import |
SHARK_EXPORT_SYMBOL void shark::csvStringToData | ( | LabeledData< FloatVector, unsigned int > & | dataset, |
std::string const & | contents, | ||
LabelPosition | lp, | ||
char | separator = ',' , |
||
char | comment = '#' , |
||
std::size_t | maximumBatchSize = LabeledData< RealVector, unsigned int >::DefaultBatchSize |
||
) |
Import labeled data from a character-separated value file.
dataset | Container storing the loaded data |
contents | the read-in file contents. |
lp | Position of the label in the record, either first or last column |
separator | Optional separator between entries, typically a comma, spaces ar automatically ignored |
comment | Character for indicating a comment, by default '#' |
maximumBatchSize | maximum size of a batch in the dataset after import |
SHARK_EXPORT_SYMBOL void shark::csvStringToData | ( | LabeledData< RealVector, RealVector > & | dataset, |
std::string const & | contents, | ||
LabelPosition | lp, | ||
std::size_t | numberOfOutputs = 1 , |
||
char | separator = ',' , |
||
char | comment = '#' , |
||
std::size_t | maximumBatchSize = LabeledData< RealVector, RealVector >::DefaultBatchSize |
||
) |
Import regression data from a read-in character-separated value file.
dataset | Container storing the loaded data |
contents | The read in csv-file |
lp | Position of the label in the record, either first or last column |
separator | Separator between entries, typically a comma or a space |
comment | Character for indicating a comment, by default empty |
numberOfOutputs | Dimensionality of label/output |
maximumBatchSize | maximum size of a batch in the dataset after import |
SHARK_EXPORT_SYMBOL void shark::csvStringToData | ( | LabeledData< RealVector, unsigned int > & | dataset, |
std::string const & | contents, | ||
LabelPosition | lp, | ||
char | separator = ',' , |
||
char | comment = '#' , |
||
std::size_t | maximumBatchSize = LabeledData< RealVector, unsigned int >::DefaultBatchSize |
||
) |
Import labeled data from a character-separated value file.
dataset | Container storing the loaded data |
contents | the read-in file contents. |
lp | Position of the label in the record, either first or last column |
separator | Optional separator between entries, typically a comma, spaces ar automatically ignored |
comment | Character for indicating a comment, by default '#' |
maximumBatchSize | maximum size of a batch in the dataset after import |
|
inline |
|
inline |
|
inlineexplicit |
|
inlineexplicit |
Construction with size and a single element.
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 |
Return the dimensionality of a dataset.
Definition at line 914 of file Dataset.h.
References shark::Data< Type >::element(), shark::Data< Type >::numberOfElements(), and SHARK_ASSERT.
Referenced by shark::dataDimension(), shark::dataDimension(), shark::NegativeAUC< LabelType, OutputType >::eval(), shark::NegativeWilcoxonMannWhitneyStatistic< LabelType, OutputType >::eval(), shark::NegativeAUC< LabelType, OutputType >::eval(), shark::exportFiltersToPGMGrid(), shark::getColumn(), shark::inputDimension(), shark::inputDimension(), shark::Centroids::inputShape(), shark::labelDimension(), shark::labelDimension(), main(), main(), shark::setColumn(), shark::NormalizeComponentsZCA::train(), shark::NormalizeComponentsUnitInterval< DataType >::train(), shark::NormalizeComponentsUnitVariance< DataType >::train(), and trainRBM().
std::size_t shark::dataDimension | ( | DataView< DatasetType > const & | view | ) |
Return the dimensionality of the dataset represented by the view.
Definition at line 350 of file DataView.h.
References shark::dataDimension(), and shark::DataView< DatasetType >::dataset().
SHARK_EXPORT_SYMBOL std::string shark::download | ( | std::string const & | url, |
unsigned short | port = 80 |
||
) |
Download a document with the HTTP protocol.
url | download URL, for example "www.shark-ml.org/index.html" |
port | TCP/IP port, defaults to 80 |
The function requests the document with a HTTP request and returns the body of the corresponding HTTP reply. In case of success this is the requested document. In case of an error the function throws an exception. Note that the function does not perform standard actions of web browsers, e.g., execute javascript or follow http redirects. All HTTP response status codes other than 200 are reported as failure to download the document and trigger an exception.
Referenced by shark::downloadCsvData(), shark::downloadCsvData(), and shark::downloadSparseData().
void shark::downloadCsvData | ( | LabeledData< InputType, RealVector > & | dataset, |
std::string const & | url, | ||
LabelPosition | lp, | ||
std::size_t | numberOfOutputs = 1 , |
||
char | separator = ',' , |
||
char | comment = '#' , |
||
unsigned short | port = 80 , |
||
std::size_t | maximumBatchSize = LabeledData<RealVector, RealVector>::DefaultBatchSize |
||
) |
Download and import a dense data (CSV) file for regression.
dataset | container storing the loaded data |
url | http URL |
lp | Position of the label in the record, either first or last column |
numberOfOutputs | dimensionality of the labels |
separator | Optional separator between entries, typically a comma, spaces ar automatically ignored |
comment | Trailing character indicating comment line. By dfault it is '#' |
port | TCP/IP port, default is 80 |
maximumBatchSize | size of batches in the dataset |
Definition at line 138 of file Download.h.
References shark::csvStringToData(), and shark::download().
void shark::downloadCsvData | ( | LabeledData< InputType, unsigned int > & | dataset, |
std::string const & | url, | ||
LabelPosition | lp, | ||
char | separator = ',' , |
||
char | comment = '#' , |
||
unsigned short | port = 80 , |
||
std::size_t | maximumBatchSize = LabeledData<RealVector, RealVector>::DefaultBatchSize |
||
) |
Download and import a dense data (CSV) file for classification.
dataset | container storing the loaded data |
url | http URL |
lp | Position of the label in the record, either first or last column |
separator | Optional separator between entries, typically a comma, spaces ar automatically ignored |
comment | Trailing character indicating comment line. By dfault it is '#' |
port | TCP/IP port, default is 80 |
maximumBatchSize | size of batches in the dataset |
Definition at line 113 of file Download.h.
References shark::csvStringToData(), and shark::download().
Referenced by main().
void shark::downloadSparseData | ( | LabeledData< InputType, LabelType > & | dataset, |
std::string const & | url, | ||
unsigned short | port = 80 , |
||
unsigned int | highestIndex = 0 , |
||
std::size_t | batchSize = LabeledData<RealVector, unsigned int>::DefaultBatchSize |
||
) |
Download and import a sparse data (libSVM) file.
dataset | container storing the loaded data |
url | http URL |
port | TCP/IP port, default is 80 |
highestIndex | highest feature index, or 0 for auto-detection |
batchSize | size of batch |
Definition at line 90 of file Download.h.
References shark::batchSize(), shark::download(), and shark::importSparseData().
Referenced by main().
|
inline |
Definition at line 232 of file Dataset.h.
Referenced by shark::MergeBudgetMaintenanceStrategy< RealVector >::addToModel(), shark::ProjectBudgetMaintenanceStrategy< RealVector >::addToModel(), shark::RemoveBudgetMaintenanceStrategy< InputType >::addToModel(), shark::CSVMProblem< MatrixT >::CSVMProblem(), shark::CSVMProblem< MatrixT >::CSVMProblem(), shark::CSVMProblem< MatrixT >::CSVMProblem(), shark::dataDimension(), shark::ImagePatches::draw(), shark::NegativeAUC< LabelType, OutputType >::eval(), shark::NegativeWilcoxonMannWhitneyStatistic< LabelType, OutputType >::eval(), shark::SvmLogisticInterpretation< InputType >::evalDerivative(), shark::exportFiltersToPGMGrid(), shark::GeneralQuadraticProblem< MatrixT >::GeneralQuadraticProblem(), shark::MarkovChain< Operator >::initializeChain(), shark::TemperedMarkovChain< Operator >::initializeChain(), main(), main(), shark::CSvmDerivative< InputType, CacheType >::modelCSvmParameterDerivative(), shark::LabelOrder::normalizeLabels(), shark::QpMcBoxDecomp< Matrix >::QpMcBoxDecomp(), shark::QpMcSimplexDecomp< Matrix >::QpMcSimplexDecomp(), shark::MergeBudgetMaintenanceStrategy< RealVector >::reduceBudget(), shark::LabelOrder::restoreOriginalLabels(), shark::KernelBudgetedSGDTrainer< InputType, CacheType >::train(), and shark::NormalizeComponentsUnitInterval< DataType >::train().
|
inline |
Definition at line 640 of file Dataset.h.
Referenced by shark::LooErrorCSvm< InputType, CacheType >::eval(), main(), shark::ModifiedKernelMatrix< InputType, CacheType >::ModifiedKernelMatrix(), shark::KernelBudgetedSGDTrainer< InputType, CacheType >::train(), shark::Perceptron< InputType >::train(), shark::CSvmTrainer< InputType, CacheType >::train(), and shark::SquaredHingeCSvmTrainer< InputType, CacheType >::train().
|
inline |
|
inline |
|
inline |
Returns therange of elements.
It is compatible to boost::range and STL and can be used whenever an algorithm requires element access via begin()/end() in which case data.elements() provides the correct interface
Definition at line 184 of file Dataset.h.
References shark::Data< Type >::numberOfBatches(), and shark::Data< Type >::numberOfElements().
|
inline |
Returns therange of elements.
It is compatible to boost::range and STL and can be used whenever an algorithm requires element access via begin()/end() in which case data.elements() provides the correct interface
Definition at line 547 of file Dataset.h.
References shark::LabeledData< InputT, LabelT >::numberOfBatches(), and shark::LabeledData< InputT, LabelT >::numberOfElements().
|
inline |
Returns the range of elements.
It is compatible to boost::range and STL and can be used whenever an algorithm requires element access via begin()/end() in which case data.elements() provides the correct interface
Definition at line 174 of file Dataset.h.
References shark::Data< Type >::numberOfBatches(), and shark::Data< Type >::numberOfElements().
Referenced by shark::NegativeGaussianProcessEvidence< InputType, OutputType, LabelType >::eval(), shark::NegativeGaussianProcessEvidence< InputType, OutputType, LabelType >::evalDerivative(), shark::ExampleModifiedKernelMatrix< InputType, CacheType >::ExampleModifiedKernelMatrix(), shark::exportCSV(), shark::exportCSV(), shark::exportKernelMatrix(), shark::GaussianKernelMatrix< T, CacheType >::GaussianKernelMatrix(), shark::getColumn(), shark::KernelMatrix< InputType, CacheType >::KernelMatrix(), main(), main(), shark::operator<<(), shark::Data< Type >::reorderElements(), shark::setColumn(), shark::KernelBudgetedSGDTrainer< InputType, CacheType >::train(), shark::KernelSGDTrainer< InputType, CacheType >::train(), shark::RankingSvmTrainer< InputType, CacheType >::train(), shark::RegularizationNetworkTrainer< InputType >::train(), shark::LassoRegression< InputVectorType >::train(), shark::RFTrainer< unsigned int >::train(), and shark::RFTrainer< RealVector >::train().
|
inline |
Returns the range of elements.
It is compatible to boost::range and STL and can be used whenever an algorithm requires element access via begin()/end() in which case data.elements() provides the correct interface
Definition at line 537 of file Dataset.h.
References shark::LabeledData< InputT, LabelT >::numberOfBatches(), and shark::LabeledData< InputT, LabelT >::numberOfElements().
Referenced by shark::JaakkolaHeuristic::JaakkolaHeuristic(), shark::operator<<(), and shark::repartitionByClass().
|
inline |
Check whether the set is empty.
Definition at line 227 of file Dataset.h.
References shark::Data< Type >::m_data.
Referenced by shark::LabeledData< InputT, LabelT >::empty().
|
inline |
Check whether the set is empty.
Definition at line 579 of file Dataset.h.
References shark::Data< Type >::empty(), and shark::LabeledData< InputT, LabelT >::m_data.
Referenced by shark::RadiusMarginQuotient< InputType, CacheType >::eval(), and shark::RadiusMarginQuotient< InputType, CacheType >::evalDerivative().
void shark::export_kernel_matrix | ( | LabeledData< InputType, LabelType > const & | dataset, |
AbstractKernelFunction< InputType > & | kernel, | ||
std::ostream & | out, | ||
KernelMatrixNormalizationType | normalizer = NONE , |
||
bool | scientific = false , |
||
unsigned int | fieldwidth = 0 |
||
) |
Definition at line 297 of file ExportKernelMatrix.h.
References shark::exportKernelMatrix().
void shark::export_kernel_matrix | ( | LabeledData< InputType, LabelType > const & | dataset, |
AbstractKernelFunction< InputType > & | kernel, | ||
std::string | fn, | ||
KernelMatrixNormalizationType | normalizer = NONE , |
||
bool | sci = false , |
||
unsigned int | width = 0 |
||
) |
Definition at line 312 of file ExportKernelMatrix.h.
References shark::exportKernelMatrix().
|
inline |
Export data to LIBSVM format.
dataset | Container storing the data |
fn | Output file |
dense | Flag for using dense output format |
oneMinusOne | Flag for applying the transformation y<-2y-1 to binary labels |
sortLabels | Flag for sorting data points according to labels |
append | Flag for appending to the output file instead of overwriting it |
Definition at line 127 of file Libsvm.h.
References shark::exportSparseData().
void shark::exportCSV | ( | Data< Type > const & | set, |
std::string | fn, | ||
char | separator = ',' , |
||
bool | sci = true , |
||
unsigned int | width = 0 |
||
) |
Format unlabeled data into a character-separated value file.
set | Container to be exported |
fn | The file to be written to |
separator | Separator between entries, typically a comma or a space |
sci | should the output be in scientific notation? |
width | argument to std::setw when writing the output |
Definition at line 464 of file Csv.h.
References shark::Data< Type >::elements(), and SHARK_RUNTIME_CHECK.
void shark::exportCSV | ( | LabeledData< InputType, LabelType > const & | dataset, |
std::string | fn, | ||
LabelPosition | lp, | ||
char | separator = ',' , |
||
bool | sci = true , |
||
unsigned int | width = 0 |
||
) |
Format labeled data into a character-separated value file.
dataset | Container to be exported |
fn | The file to be written to |
lp | Position of the label in the record, either first or last column |
separator | Separator between entries, typically a comma or a space |
sci | should the output be in scientific notation? |
width | argument to std::setw when writing the output |
Definition at line 486 of file Csv.h.
References shark::Data< Type >::elements(), shark::LabeledData< InputT, LabelT >::inputs(), shark::LabeledData< InputT, LabelT >::labels(), and SHARK_RUNTIME_CHECK.
|
inline |
Exports a set of filters as a grid image.
It is assumed that the filters each form a row in the filter-matrix. Moreover, the sizes of the filter images has to be given and it must gold width*height=W.size2(). The filters a re printed on a single image as a grid. The grid will be close to square. And the image are separated by a black 1 pixel wide line. The output will be normalized so that all images are on the same scale.
basename | File to write to. ".pgm" is appended to the filename |
filters | Matrix storing the filters row by row |
width | Width of the filter image |
height | Height of th filter image |
Definition at line 182 of file Pgm.h.
References shark::Data< Type >::batch(), shark::dataDimension(), shark::Data< Type >::element(), shark::exportPGM(), shark::Data< Type >::numberOfBatches(), shark::Data< Type >::numberOfElements(), and SIZE_CHECK.
|
inline |
Exports a set of filters as a grid image.
It is assumed that the filters each form a row in the filter-matrix. Moreover, the sizes of the filter images has to be given and it must gold width*height=W.size2(). The filters a re printed on a single image as a grid. The grid will be close to square. And the image are separated by a black 1 pixel wide line. The output will be normalized so that all images are on the same scale.
basename | File to write to. ".pgm" is appended to the filename |
filters | Matrix storing the filters row by row |
width | Width of the filter image |
height | Height of th filter image |
Definition at line 145 of file Pgm.h.
References shark::exportPGM(), and SIZE_CHECK.
Referenced by main().
void shark::exportKernelMatrix | ( | LabeledData< InputType, LabelType > const & | dataset, |
AbstractKernelFunction< InputType > & | kernel, | ||
std::ostream & | out, | ||
KernelMatrixNormalizationType | normalizer = NONE , |
||
bool | scientific = false , |
||
unsigned int | fieldwidth = 0 |
||
) |
Write a kernel Gram matrix to stream.
dataset | data basis for the Gram matrix |
kernel | pointer to kernel function to be used |
out | The stream to be written to |
normalizer | what kind of normalization to apply. see enum declaration for details. |
scientific | should the output be in scientific notation? |
fieldwidth | field width for pretty printing |
Definition at line 76 of file ExportKernelMatrix.h.
References shark::CENTER_AND_MULTIPLICATIVE_TRACE_ONE, shark::CENTER_ONLY, shark::Data< Type >::elements(), shark::AbstractKernelFunction< InputTypeT >::eval(), shark::ScaledKernel< InputType >::factor(), shark::LabeledData< InputT, LabelT >::inputs(), shark::LabeledData< InputT, LabelT >::labels(), shark::mean(), shark::MULTIPLICATIVE_TRACE_N, shark::MULTIPLICATIVE_TRACE_ONE, shark::MULTIPLICATIVE_VARIANCE_ONE, shark::NONE, SHARK_ASSERT, SHARKEXCEPTION, shark::DataView< DatasetType >::size(), SIZE_CHECK, and shark::NormalizeKernelUnitVariance< InputType >::train().
Referenced by shark::export_kernel_matrix(), shark::export_kernel_matrix(), and shark::exportKernelMatrix().
void shark::exportKernelMatrix | ( | LabeledData< InputType, LabelType > const & | dataset, |
AbstractKernelFunction< InputType > & | kernel, | ||
std::string | fn, | ||
KernelMatrixNormalizationType | normalizer = NONE , |
||
bool | sci = false , |
||
unsigned int | width = 0 |
||
) |
Write a kernel Gram matrix to file.
dataset | data basis for the Gram matrix |
kernel | pointer to kernel function to be used |
fn | The filename of the file to be written to |
normalizer | what kind of normalization to apply. see enum declaration for details. |
sci | should the output be in scientific notation? |
width | field width for pretty printing |
Definition at line 273 of file ExportKernelMatrix.h.
References shark::exportKernelMatrix().
void shark::exportPGM | ( | std::string const & | fileName, |
T const & | data, | ||
std::size_t | sx, | ||
std::size_t | sy, | ||
bool | normalize = false |
||
) |
Export a PGM image to file.
fileName | File to write to |
data | Linear object storing image |
sx | Width of image |
sy | Height of image |
normalize | Adjust values to [0,255], default false |
Definition at line 117 of file Pgm.h.
References SIZE_CHECK.
Referenced by shark::exportFiltersToPGMGrid(), shark::exportFiltersToPGMGrid(), and main().
void shark::exportSparseData | ( | LabeledData< InputType, RealVector > const & | dataset, |
const std::string & | fn, | ||
bool | append = false |
||
) |
Export regression data to sparse data (libSVM) format.
dataset | Container storing the data |
fn | Output file |
append | Flag for appending to the output file instead of overwriting it |
Definition at line 309 of file SparseData.h.
References shark::exportSparseData(), and SHARK_RUNTIME_CHECK.
void shark::exportSparseData | ( | LabeledData< InputType, RealVector > const & | dataset, |
std::ostream & | stream | ||
) |
Export regression data to sparse data (libSVM) format.
dataset | Container storing the data |
stream | Output stream |
Definition at line 284 of file SparseData.h.
References shark::LabeledData< InputT, LabelT >::batch(), shark::batchSize(), shark::getBatchElement(), shark::LabeledData< InputT, LabelT >::numberOfBatches(), and SHARK_ASSERT.
void shark::exportSparseData | ( | LabeledData< InputType, unsigned int > const & | dataset, |
const std::string & | fn, | ||
bool | oneMinusOne = true , |
||
bool | sortLabels = false , |
||
bool | append = false |
||
) |
Export classification data to sparse data (libSVM) format.
dataset | Container storing the data |
fn | Output file name |
oneMinusOne | Flag for applying the transformation y<-2y-1 to binary labels |
sortLabels | Flag for sorting data points according to labels |
append | Flag for appending to the output file instead of overwriting it |
Definition at line 264 of file SparseData.h.
References shark::exportSparseData(), and SHARK_RUNTIME_CHECK.
void shark::exportSparseData | ( | LabeledData< InputType, unsigned int > const & | dataset, |
std::ostream & | stream, | ||
bool | oneMinusOne = true , |
||
bool | sortLabels = false |
||
) |
Export classification data to sparse data (libSVM) format.
dataset | Container storing the data |
stream | Output stream |
oneMinusOne | Flag for applying the transformation y<-2y-1 to binary labels |
sortLabels | Flag for sorting data points according to labels |
Definition at line 222 of file SparseData.h.
References shark::LabeledData< InputT, LabelT >::batch(), shark::batchSize(), shark::getBatchElement(), shark::LabeledData< InputT, LabelT >::numberOfBatches(), and shark::numberOfClasses().
Referenced by shark::export_libsvm(), shark::exportSparseData(), and shark::exportSparseData().
RowType shark::getColumn | ( | Data< RowType > const & | data, |
std::size_t | columnID | ||
) |
Definition at line 1125 of file Dataset.h.
References shark::dataDimension(), shark::Data< Type >::elements(), shark::Data< Type >::numberOfElements(), and SHARK_ASSERT.
|
inline |
Creates a vector with the batch sizes of every batch.
This method can be used together with repartition to ensure that two datasets have the same batch structure.
Definition at line 326 of file Dataset.h.
References shark::Data< Type >::m_data.
Referenced by shark::LabeledData< InputT, LabelT >::getPartitioning().
|
inline |
Creates a vector with the batch sizes of every batch.
This method can be used together with repartition to ensure that two datasets have the same batch structure.
Definition at line 746 of file Dataset.h.
References shark::Data< Type >::getPartitioning(), and shark::LabeledData< InputT, LabelT >::m_data.
|
inline |
Import data from a LIBSVM file.
dataset | container storing the loaded data |
stream | stream to be read from |
highestIndex | highest feature index, or 0 for auto-detection |
batchSize | size of batch |
Definition at line 75 of file Libsvm.h.
References shark::batchSize(), and shark::importSparseData().
|
inline |
Import data from a LIBSVM file.
dataset | container storing the loaded data |
fn | the file to be read from |
highestIndex | highest feature index, or 0 for auto-detection |
batchSize | size of batch |
Definition at line 107 of file Libsvm.h.
References shark::batchSize(), and shark::importSparseData().
|
inline |
Import data from a LIBSVM file.
dataset | container storing the loaded data |
stream | stream to be read from |
highestIndex | highest feature index, or 0 for auto-detection |
batchSize | size of batch |
Definition at line 59 of file Libsvm.h.
References shark::batchSize(), and shark::importSparseData().
|
inline |
Import data from a LIBSVM file.
dataset | container storing the loaded data |
fn | the file to be read from |
highestIndex | highest feature index, or 0 for auto-detection |
batchSize | size of batch |
Definition at line 91 of file Libsvm.h.
References shark::batchSize(), and shark::importSparseData().
void shark::importCSV | ( | Data< T > & | data, |
std::string | fn, | ||
char | separator = ',' , |
||
char | comment = '#' , |
||
std::size_t | maximumBatchSize = Data<T>::DefaultBatchSize , |
||
std::size_t | titleLines = 0 |
||
) |
Import a Dataset from a csv file.
data | Container storing the loaded data |
fn | The file to be read from |
separator | Optional separator between entries, typically a comma, spaces ar automatically ignored |
comment | Trailing character indicating comment line. By dfault it is '#' |
maximumBatchSize | Size of batches in the dataset |
titleLines | Specifies a number of lines to be skipped in the beginning of the file |
Definition at line 369 of file Csv.h.
References shark::csvStringToData(), and SHARK_RUNTIME_CHECK.
Referenced by loadData(), main(), and main().
void shark::importCSV | ( | LabeledData< blas::vector< T >, blas::vector< T > > & | data, |
std::string | fn, | ||
LabelPosition | lp, | ||
std::size_t | numberOfOutputs = 1 , |
||
char | separator = ',' , |
||
char | comment = '#' , |
||
std::size_t | maximumBatchSize = LabeledData<RealVector, RealVector>::DefaultBatchSize |
||
) |
Import a labeled Dataset from a csv file.
data | Container storing the loaded data |
fn | The file to be read from |
lp | Position of the label in the record, either first or last column |
numberOfOutputs | dimensionality of the labels |
separator | Optional separator between entries, typically a comma, spaces ar automatically ignored |
comment | Trailing character indicating comment line. By dfault it is '#' |
maximumBatchSize | Size of batches in the dataset |
Definition at line 434 of file Csv.h.
References shark::csvStringToData(), and SHARK_RUNTIME_CHECK.
void shark::importCSV | ( | LabeledData< blas::vector< T >, unsigned int > & | data, |
std::string | fn, | ||
LabelPosition | lp, | ||
char | separator = ',' , |
||
char | comment = '#' , |
||
std::size_t | maximumBatchSize = LabeledData<RealVector, unsigned int>::DefaultBatchSize |
||
) |
Import a labeled Dataset from a csv file.
data | Container storing the loaded data |
fn | The file to be read from |
lp | Position of the label in the record, either first or last column |
separator | Optional separator between entries, typically a comma, spaces ar automatically ignored |
comment | Trailing character indicating comment line. By dfault it is '#' |
maximumBatchSize | Size of batches in the dataset |
Definition at line 403 of file Csv.h.
References shark::csvStringToData(), and SHARK_RUNTIME_CHECK.
void shark::importPGM | ( | std::string const & | fileName, |
T & | data, | ||
std::size_t & | sx, | ||
std::size_t & | sy | ||
) |
Import a PGM image from file.
fileName | The file to read from |
data | Linear object for storing image |
sx | Width of imported image |
sy | Height of imported image |
Definition at line 102 of file Pgm.h.
Referenced by shark::importPGMSet().
void shark::importPGMSet | ( | std::string const & | p, |
Data< T > & | set | ||
) |
Import PGM images scanning a directory recursively.
All images are required to have the same size. the shape of the images is stored in set.shape()
p | Directory |
set | Set storing images |
Definition at line 221 of file Pgm.h.
References shark::createDataFromRange(), shark::importPGM(), shark::Data< Type >::shape(), and SHARKEXCEPTION.
Referenced by main().
SHARK_EXPORT_SYMBOL void shark::importSparseData | ( | LabeledData< CompressedFloatVector, FloatVector > & | dataset, |
std::istream & | stream, | ||
unsigned int | highestIndex = 0 , |
||
std::size_t | batchSize = LabeledData< RealVector, RealVector >::DefaultBatchSize |
||
) |
SHARK_EXPORT_SYMBOL void shark::importSparseData | ( | LabeledData< CompressedFloatVector, FloatVector > & | dataset, |
std::string | fn, | ||
unsigned int | highestIndex = 0 , |
||
std::size_t | batchSize = LabeledData< RealVector, RealVector >::DefaultBatchSize |
||
) |
SHARK_EXPORT_SYMBOL void shark::importSparseData | ( | LabeledData< CompressedFloatVector, unsigned int > & | dataset, |
std::istream & | stream, | ||
unsigned int | highestIndex = 0 , |
||
std::size_t | batchSize = LabeledData< RealVector, unsigned int >::DefaultBatchSize |
||
) |
SHARK_EXPORT_SYMBOL void shark::importSparseData | ( | LabeledData< CompressedFloatVector, unsigned int > & | dataset, |
std::string | fn, | ||
unsigned int | highestIndex = 0 , |
||
std::size_t | batchSize = LabeledData< RealVector, unsigned int >::DefaultBatchSize |
||
) |
SHARK_EXPORT_SYMBOL void shark::importSparseData | ( | LabeledData< CompressedRealVector, RealVector > & | dataset, |
std::istream & | stream, | ||
unsigned int | highestIndex = 0 , |
||
std::size_t | batchSize = LabeledData< RealVector, RealVector >::DefaultBatchSize |
||
) |
Import regression data from a sparse data (libSVM) file.
dataset | container storing the loaded data |
stream | stream to be read from |
highestIndex | highest feature index, or 0 for auto-detection |
batchSize | size of batch |
SHARK_EXPORT_SYMBOL void shark::importSparseData | ( | LabeledData< CompressedRealVector, RealVector > & | dataset, |
std::string | fn, | ||
unsigned int | highestIndex = 0 , |
||
std::size_t | batchSize = LabeledData< RealVector, RealVector >::DefaultBatchSize |
||
) |
Import regression data from a sparse data (libSVM) file.
dataset | container storing the loaded data |
fn | the file to be read from |
highestIndex | highest feature index, or 0 for auto-detection |
batchSize | size of batch |
SHARK_EXPORT_SYMBOL void shark::importSparseData | ( | LabeledData< CompressedRealVector, unsigned int > & | dataset, |
std::istream & | stream, | ||
unsigned int | highestIndex = 0 , |
||
std::size_t | batchSize = LabeledData< RealVector, unsigned int >::DefaultBatchSize |
||
) |
Import classification data from a sparse data (libSVM) file.
dataset | container storing the loaded data |
stream | stream to be read from |
highestIndex | highest feature index, or 0 for auto-detection |
batchSize | size of batch |
SHARK_EXPORT_SYMBOL void shark::importSparseData | ( | LabeledData< CompressedRealVector, unsigned int > & | dataset, |
std::string | fn, | ||
unsigned int | highestIndex = 0 , |
||
std::size_t | batchSize = LabeledData< RealVector, unsigned int >::DefaultBatchSize |
||
) |
Import classification data from a sparse data (libSVM) file.
dataset | container storing the loaded data |
fn | the file to be read from |
highestIndex | highest feature index, or 0 for auto-detection |
batchSize | size of batch |
SHARK_EXPORT_SYMBOL void shark::importSparseData | ( | LabeledData< FloatVector, FloatVector > & | dataset, |
std::istream & | stream, | ||
unsigned int | highestIndex = 0 , |
||
std::size_t | batchSize = LabeledData< RealVector, RealVector >::DefaultBatchSize |
||
) |
SHARK_EXPORT_SYMBOL void shark::importSparseData | ( | LabeledData< FloatVector, FloatVector > & | dataset, |
std::string | fn, | ||
unsigned int | highestIndex = 0 , |
||
std::size_t | batchSize = LabeledData< RealVector, RealVector >::DefaultBatchSize |
||
) |
SHARK_EXPORT_SYMBOL void shark::importSparseData | ( | LabeledData< FloatVector, unsigned int > & | dataset, |
std::istream & | stream, | ||
unsigned int | highestIndex = 0 , |
||
std::size_t | batchSize = LabeledData< RealVector, unsigned int >::DefaultBatchSize |
||
) |
SHARK_EXPORT_SYMBOL void shark::importSparseData | ( | LabeledData< FloatVector, unsigned int > & | dataset, |
std::string | fn, | ||
unsigned int | highestIndex = 0 , |
||
std::size_t | batchSize = LabeledData< RealVector, unsigned int >::DefaultBatchSize |
||
) |
SHARK_EXPORT_SYMBOL void shark::importSparseData | ( | LabeledData< RealVector, RealVector > & | dataset, |
std::istream & | stream, | ||
unsigned int | highestIndex = 0 , |
||
std::size_t | batchSize = LabeledData< RealVector, RealVector >::DefaultBatchSize |
||
) |
Import regression data from a sparse data (libSVM) file.
dataset | container storing the loaded data |
stream | stream to be read from |
highestIndex | highest feature index, or 0 for auto-detection |
batchSize | size of batch |
SHARK_EXPORT_SYMBOL void shark::importSparseData | ( | LabeledData< RealVector, RealVector > & | dataset, |
std::string | fn, | ||
unsigned int | highestIndex = 0 , |
||
std::size_t | batchSize = LabeledData< RealVector, RealVector >::DefaultBatchSize |
||
) |
Import regression data from a sparse data (libSVM) file.
dataset | container storing the loaded data |
fn | the file to be read from |
highestIndex | highest feature index, or 0 for auto-detection |
batchSize | size of batch |
SHARK_EXPORT_SYMBOL void shark::importSparseData | ( | LabeledData< RealVector, unsigned int > & | dataset, |
std::istream & | stream, | ||
unsigned int | highestIndex = 0 , |
||
std::size_t | batchSize = LabeledData< RealVector, unsigned int >::DefaultBatchSize |
||
) |
Import classification data from a sparse data (libSVM) file.
dataset | container storing the loaded data |
stream | stream to be read from |
highestIndex | highest feature index, or 0 for auto-detection |
batchSize | size of batch |
Referenced by shark::downloadSparseData(), shark::import_libsvm(), shark::import_libsvm(), shark::import_libsvm(), shark::import_libsvm(), and main().
SHARK_EXPORT_SYMBOL void shark::importSparseData | ( | LabeledData< RealVector, unsigned int > & | dataset, |
std::string | fn, | ||
unsigned int | highestIndex = 0 , |
||
std::size_t | batchSize = LabeledData< RealVector, unsigned int >::DefaultBatchSize |
||
) |
Import classification data from a sparse data (libSVM) file.
dataset | container storing the loaded data |
fn | the file to be read from |
highestIndex | highest feature index, or 0 for auto-detection |
batchSize | size of batch |
|
inline |
Definition at line 365 of file Dataset.h.
References shark::Data< Type >::m_data, shark::Data< Type >::m_shape, and shark::subset().
|
inline |
Fill in the subset defined by the list of indices.
Definition at line 773 of file Dataset.h.
References shark::Data< Type >::indexedSubset(), shark::LabeledData< InputT, LabelT >::LabeledData(), shark::LabeledData< InputT, LabelT >::m_data, and shark::LabeledData< InputT, LabelT >::m_label.
Referenced by shark::binarySubProblem(), and main().
|
inline |
Fill in the subset defined by the list of indices as well as its complement.
Definition at line 358 of file Dataset.h.
References shark::Data< Type >::m_data, and shark::subset().
Referenced by shark::LabeledData< InputT, LabelT >::indexedSubset().
void shark::initRandomNormal | ( | AbstractModel< InputType, OutputType, ParameterVectorType > & | model, |
double | s | ||
) |
Initialize model parameters normally distributed.
model | model to be initialized |
s | variance of mean-free normal distribution |
Definition at line 286 of file AbstractModel.h.
References shark::random::globalRng, shark::IParameterizable< VectorType >::numberOfParameters(), and shark::IParameterizable< VectorType >::setParameterVector().
void shark::initRandomUniform | ( | AbstractModel< InputType, OutputType, ParameterVectorType > & | model, |
double | lower, | ||
double | upper | ||
) |
Initialize model parameters uniformly at random.
model | model to be initialized |
lower | lower bound of initialization interval |
upper | upper bound of initialization interval |
Definition at line 300 of file AbstractModel.h.
References shark::random::globalRng, shark::IParameterizable< VectorType >::numberOfParameters(), and shark::IParameterizable< VectorType >::setParameterVector().
Referenced by experiment(), main(), trainProblem(), and trainRBM().
std::size_t shark::inputDimension | ( | DataView< DatasetType > const & | view | ) |
Return the input dimensionality of the labeled dataset represented by the view.
Definition at line 339 of file DataView.h.
References shark::DataView< DatasetType >::dataset(), and shark::inputDimension().
std::size_t shark::inputDimension | ( | LabeledData< InputType, LabelType > const & | dataset | ) |
Return the input dimensionality of a labeled dataset.
Definition at line 921 of file Dataset.h.
References shark::dataDimension(), and shark::LabeledData< InputT, LabelT >::inputs().
Referenced by shark::ProjectBudgetMaintenanceStrategy< RealVector >::addToModel(), shark::RFClassifier< LabelType >::computeFeatureImportances(), shark::inputDimension(), shark::JaakkolaHeuristic::JaakkolaHeuristic(), main(), main(), shark::SquaredHingeLinearCSvmTrainer< InputType >::train(), shark::LassoRegression< InputVectorType >::train(), shark::RFTrainer< unsigned int >::train(), and shark::RFTrainer< RealVector >::train().
|
inline |
Access to the base_type class as "inputs".
Added for consistency with the LabeledData::labels() method.
Definition at line 450 of file Dataset.h.
Referenced by shark::WeightedLabeledData< InputT, LabelT >::inputs(), and shark::WeightedLabeledData< InputT, LabelT >::inputs().
|
inline |
Access to inputs as a separate container.
Definition at line 588 of file Dataset.h.
References shark::LabeledData< InputT, LabelT >::m_data.
|
inline |
Access to the base_type class as "inputs".
Added for consistency with the LabeledData::labels() method.
|
inline |
Access to inputs as a separate container.
Definition at line 584 of file Dataset.h.
References shark::LabeledData< InputT, LabelT >::m_data.
Referenced by shark::ProjectBudgetMaintenanceStrategy< RealVector >::addToModel(), shark::RadiusMarginQuotient< InputType, CacheType >::computeRadiusMargin(), shark::NegativeGaussianProcessEvidence< InputType, OutputType, LabelType >::eval(), shark::LooErrorCSvm< InputType, CacheType >::eval(), shark::CrossValidationError< ModelTypeT, LabelTypeT >::eval(), shark::SvmLogisticInterpretation< InputType >::eval(), shark::NegativeGaussianProcessEvidence< InputType, OutputType, LabelType >::evalDerivative(), shark::RadiusMarginQuotient< InputType, CacheType >::evalDerivative(), shark::SvmLogisticInterpretation< InputType >::evalDerivative(), experiment(), shark::exportCSV(), shark::exportKernelMatrix(), shark::inputDimension(), shark::LabeledData< InputT, LabelT >::LabeledData(), main(), main(), shark::LabeledData< InputT, LabelT >::push_back(), run(), run_one_trial(), shark::selectInputFeatures(), shark::toGPU(), shark::KernelBudgetedSGDTrainer< InputType, CacheType >::train(), shark::KernelSGDTrainer< InputType, CacheType >::train(), shark::Perceptron< InputType >::train(), shark::CSvmTrainer< InputType, CacheType >::train(), shark::SquaredHingeCSvmTrainer< InputType, CacheType >::train(), shark::RankingSvmTrainer< InputType, CacheType >::train(), shark::RegularizationNetworkTrainer< InputType >::train(), shark::EpsilonSvmTrainer< InputType, CacheType >::train(), shark::MissingFeatureSvmTrainer< InputType, CacheType >::train(), shark::LassoRegression< InputVectorType >::train(), trainProblem(), shark::transformInputs(), and shark::transformLabels().
|
inline |
Returns the Shape of the inputs.
Definition at line 661 of file Dataset.h.
References shark::LabeledData< InputT, LabelT >::m_data, and shark::Data< Type >::shape().
|
inline |
Returns the Shape of the inputs.
Definition at line 656 of file Dataset.h.
References shark::LabeledData< InputT, LabelT >::m_data, and shark::Data< Type >::shape().
Referenced by shark::bootstrap(), main(), shark::SimpleNearestNeighbors< InputType, LabelType >::SimpleNearestNeighbors(), and shark::TreeNearestNeighbors< InputType, LabelType >::TreeNearestNeighbors().
std::size_t shark::labelDimension | ( | DataView< DatasetType > const & | view | ) |
Return the label dimensionality of the labeled dataset represented by the view.
Definition at line 344 of file DataView.h.
References shark::DataView< DatasetType >::dataset(), and shark::labelDimension().
std::size_t shark::labelDimension | ( | LabeledData< InputType, LabelType > const & | dataset | ) |
Return the label/output dimensionality of a labeled dataset.
Definition at line 927 of file Dataset.h.
References shark::dataDimension(), and shark::LabeledData< InputT, LabelT >::labels().
Referenced by shark::labelDimension(), main(), shark::RegularizationNetworkTrainer< InputType >::train(), and shark::EpsilonSvmTrainer< InputType, CacheType >::train().
|
inline |
Empty data set.
Definition at line 604 of file Dataset.h.
Referenced by shark::LabeledData< InputT, LabelT >::indexedSubset(), and shark::LabeledData< InputT, LabelT >::splice().
|
inline |
Construction from data.
Beware that when calling this constructor the organization of batches must be equal in both containers. This Constructor will not split the data!
Definition at line 629 of file Dataset.h.
References shark::Data< Type >::batch(), shark::LabeledData< InputT, LabelT >::inputs(), shark::LabeledData< InputT, LabelT >::labels(), shark::Data< Type >::numberOfBatches(), shark::Data< Type >::numberOfElements(), SHARK_RUNTIME_CHECK, and SIZE_CHECK.
|
inline |
|
inline |
|
inline |
Access to labels as a separate container.
Definition at line 597 of file Dataset.h.
References shark::LabeledData< InputT, LabelT >::m_label.
|
inline |
Access to labels as a separate container.
Definition at line 593 of file Dataset.h.
References shark::LabeledData< InputT, LabelT >::m_label.
Referenced by shark::classSizes(), shark::RadiusMarginQuotient< InputType, CacheType >::computeRadiusMargin(), shark::NegativeGaussianProcessEvidence< InputType, OutputType, LabelType >::eval(), shark::LooErrorCSvm< InputType, CacheType >::eval(), shark::CrossValidationError< ModelTypeT, LabelTypeT >::eval(), shark::SvmLogisticInterpretation< InputType >::eval(), shark::NegativeGaussianProcessEvidence< InputType, OutputType, LabelType >::evalDerivative(), shark::SvmLogisticInterpretation< InputType >::evalDerivative(), experiment(), shark::exportCSV(), shark::exportKernelMatrix(), shark::KernelTargetAlignment< InputType, LabelType >::KernelTargetAlignment(), shark::labelDimension(), shark::LabeledData< InputT, LabelT >::LabeledData(), main(), main(), shark::LabelOrder::normalizeLabels(), shark::numberOfClasses(), shark::LabeledData< InputT, LabelT >::push_back(), shark::LabelOrder::restoreOriginalLabels(), run(), run_one_trial(), shark::selectInputFeatures(), shark::toGPU(), shark::KernelBudgetedSGDTrainer< InputType, CacheType >::train(), shark::KernelSGDTrainer< InputType, CacheType >::train(), shark::CSvmTrainer< InputType, CacheType >::train(), shark::RankingSvmTrainer< InputType, CacheType >::train(), shark::RegularizationNetworkTrainer< InputType >::train(), shark::LassoRegression< InputVectorType >::train(), trainProblem(), shark::transformInputs(), and shark::transformLabels().
|
inline |
Returns the Shape of the labels.
Definition at line 671 of file Dataset.h.
References shark::LabeledData< InputT, LabelT >::m_label, and shark::Data< Type >::shape().
|
inline |
Returns the Shape of the labels.
Definition at line 666 of file Dataset.h.
References shark::LabeledData< InputT, LabelT >::m_label, and shark::Data< Type >::shape().
Referenced by shark::bootstrap(), and main().
|
inlinevirtual |
This method makes the vector independent of all siblings and parents.
Definition at line 279 of file Dataset.h.
References shark::Data< Type >::m_data.
Referenced by main(), and shark::LabeledData< InputT, LabelT >::makeIndependent().
|
inlinevirtual |
This method makes the vector independent of all siblings and parents.
Definition at line 690 of file Dataset.h.
References shark::LabeledData< InputT, LabelT >::m_data, shark::LabeledData< InputT, LabelT >::m_label, and shark::Data< Type >::makeIndependent().
Referenced by main().
T shark::maxExpInput | ( | ) |
T shark::minExpInput | ( | ) |
|
inline |
Returns the number of batches of the set.
Definition at line 207 of file Dataset.h.
References shark::Data< Type >::m_data.
Referenced by shark::calculateKernelMatrixParameterDerivative(), shark::calculateMixedKernelMatrix(), shark::calculateRegularizedKernelMatrix(), shark::classSizes(), shark::Data< Type >::elements(), shark::Data< Type >::elements(), shark::KernelExpansion< InputType >::eval(), shark::AbstractLoss< LabelT, OutputT >::eval(), shark::ZeroOneLoss< unsigned int, blas::vector< Float > >::eval(), shark::NegativeLogLikelihood::eval(), shark::VariationalAutoencoderError< SearchPointType >::eval(), shark::NegativeLogLikelihood::evalDerivative(), shark::ContrastiveDivergence< Operator >::evalDerivative(), shark::VariationalAutoencoderError< SearchPointType >::evalDerivative(), shark::exportFiltersToPGMGrid(), shark::LabeledData< InputT, LabelT >::LabeledData(), main(), shark::LabeledData< InputT, LabelT >::numberOfBatches(), shark::numberOfClasses(), shark::Data< Type >::reorderElements(), shark::toGPU(), shark::NormalizeKernelUnitVariance< InputType >::train(), shark::transform(), and shark::transform().
|
inline |
Returns the number of batches of the set.
Definition at line 570 of file Dataset.h.
References shark::LabeledData< InputT, LabelT >::m_data, and shark::Data< Type >::numberOfBatches().
Referenced by shark::binarySubProblem(), shark::createCVBatch(), shark::LabeledData< InputT, LabelT >::elements(), shark::LabeledData< InputT, LabelT >::elements(), shark::KernelTargetAlignment< InputType, LabelType >::evalDerivative(), shark::exportSparseData(), shark::exportSparseData(), and shark::SimpleNearestNeighbors< InputType, LabelType >::getNeighbors().
|
inline |
Return the number of classes of a set of class labels with unsigned int label encoding.
Definition at line 893 of file Dataset.h.
References shark::Data< Type >::batch(), and shark::Data< Type >::numberOfBatches().
Referenced by shark::classSizes(), shark::classWeight(), shark::createCVSameSizeBalanced(), shark::exportSparseData(), shark::JaakkolaHeuristic::JaakkolaHeuristic(), main(), main(), shark::numberOfClasses(), shark::numberOfClasses(), shark::numberOfClasses(), shark::numberOfClasses(), shark::toGPU(), shark::KernelBudgetedSGDTrainer< InputType, CacheType >::train(), shark::KernelSGDTrainer< InputType, CacheType >::train(), shark::CSvmTrainer< InputType, CacheType >::train(), shark::CSvmTrainer< InputType, CacheType >::train(), shark::LinearCSvmTrainer< InputType >::train(), and shark::MissingFeatureSvmTrainer< InputType, CacheType >::train().
std::size_t shark::numberOfClasses | ( | DataView< DatasetType > const & | view | ) |
Return the number of classes (size of the label vector) of a classification dataset with RealVector label encoding.
Definition at line 333 of file DataView.h.
References shark::DataView< DatasetType >::dataset(), and shark::numberOfClasses().
std::size_t shark::numberOfClasses | ( | LabeledData< InputType, unsigned int > const & | dataset | ) |
Return the number of classes (highest label value +1) of a classification dataset with unsigned int label encoding.
Definition at line 932 of file Dataset.h.
References shark::LabeledData< InputT, LabelT >::labels(), and shark::numberOfClasses().
|
inline |
Returns the total number of elements.
Definition at line 211 of file Dataset.h.
References shark::Data< Type >::m_data.
Referenced by shark::MergeBudgetMaintenanceStrategy< RealVector >::addToModel(), shark::ProjectBudgetMaintenanceStrategy< RealVector >::addToModel(), shark::RemoveBudgetMaintenanceStrategy< InputType >::addToModel(), shark::bootstrap(), shark::calculateMixedKernelMatrix(), shark::calculateRegularizedKernelMatrix(), shark::CSVMProblem< MatrixT >::CSVMProblem(), shark::CSVMProblem< MatrixT >::CSVMProblem(), shark::CSVMProblem< MatrixT >::CSVMProblem(), shark::dataDimension(), shark::Data< Type >::elements(), shark::Data< Type >::elements(), shark::NegativeAUC< LabelType, OutputType >::eval(), shark::NegativeWilcoxonMannWhitneyStatistic< LabelType, OutputType >::eval(), shark::NegativeAUC< LabelType, OutputType >::eval(), shark::AbstractLoss< LabelT, OutputT >::eval(), shark::ZeroOneLoss< unsigned int, blas::vector< Float > >::eval(), shark::NegativeLogLikelihood::eval(), shark::ExactGradient< RBMType >::eval(), shark::NegativeLogLikelihood::evalDerivative(), shark::ExactGradient< RBMType >::evalDerivative(), shark::SingleChainApproximator< MarkovChainType >::evalDerivative(), shark::ExampleModifiedKernelMatrix< InputType, CacheType >::ExampleModifiedKernelMatrix(), shark::exportFiltersToPGMGrid(), shark::GaussianKernelMatrix< T, CacheType >::GaussianKernelMatrix(), shark::GeneralQuadraticProblem< MatrixT >::GeneralQuadraticProblem(), shark::getColumn(), shark::MarkovChain< Operator >::initializeChain(), shark::TemperedMarkovChain< Operator >::initializeChain(), shark::KernelMatrix< InputType, CacheType >::KernelMatrix(), shark::kMeans(), shark::LabeledData< InputT, LabelT >::LabeledData(), main(), main(), shark::LabeledData< InputT, LabelT >::numberOfElements(), shark::QpMcBoxDecomp< Matrix >::QpMcBoxDecomp(), shark::QpMcSimplexDecomp< Matrix >::QpMcSimplexDecomp(), shark::MergeBudgetMaintenanceStrategy< RealVector >::reduceBudget(), shark::setColumn(), shark::MultiChainApproximator< MarkovChainType >::setData(), shark::KernelExpansion< InputType >::setStructure(), shark::KernelExpansion< InputType >::sparsify(), shark::RankingSvmTrainer< InputType, CacheType >::train(), shark::NormalizeComponentsZCA::train(), shark::NormalizeComponentsUnitInterval< DataType >::train(), shark::NormalizeComponentsUnitVariance< DataType >::train(), and shark::NormalizeKernelUnitVariance< InputType >::train().
|
inline |
Returns the total number of elements.
Definition at line 574 of file Dataset.h.
References shark::LabeledData< InputT, LabelT >::m_data, and shark::Data< Type >::numberOfElements().
Referenced by shark::bootstrap(), shark::RFClassifier< LabelType >::computeOOBerror(), shark::RadiusMarginQuotient< InputType, CacheType >::computeRadiusMargin(), shark::createCVFullyIndexed(), shark::createCVIID(), shark::createCVIndexed(), shark::createCVSameSize(), shark::LabeledData< InputT, LabelT >::elements(), shark::LabeledData< InputT, LabelT >::elements(), shark::NegativeGaussianProcessEvidence< InputType, OutputType, LabelType >::eval(), shark::NegativeGaussianProcessEvidence< InputType, OutputType, LabelType >::evalDerivative(), shark::SvmLogisticInterpretation< InputType >::evalDerivative(), shark::JaakkolaHeuristic::JaakkolaHeuristic(), shark::KernelTargetAlignment< InputType, LabelType >::KernelTargetAlignment(), main(), main(), shark::LabelOrder::normalizeLabels(), shark::repartitionByClass(), shark::LabelOrder::restoreOriginalLabels(), shark::LabeledData< InputT, LabelT >::shuffle(), shark::Pegasos< VectorType >::solve(), shark::McPegasos< VectorType >::solve(), shark::KernelBudgetedSGDTrainer< InputType, CacheType >::train(), shark::KernelSGDTrainer< InputType, CacheType >::train(), shark::Perceptron< InputType >::train(), shark::CSvmTrainer< InputType, CacheType >::train(), and shark::SquaredHingeCSvmTrainer< InputType, CacheType >::train().
LabeledData< I, unsigned int > shark::oneVersusRestProblem | ( | LabeledData< I, unsigned int >const & | data, |
unsigned int | oneClass | ||
) |
Construct a binary (two-class) one-versus-rest problem from a multi-class problem.
Definition at line 1117 of file Dataset.h.
References shark::transformLabels().
|
inline |
std::ostream & shark::operator<< | ( | std::ostream & | stream, |
const Data< T > & | d | ||
) |
Outstream of elements.
Definition at line 385 of file Dataset.h.
References shark::Data< Type >::elements().
std::ostream & shark::operator<< | ( | std::ostream & | stream, |
const LabeledData< T, U > & | d | ||
) |
brief Outstream of elements for labeled data.
Definition at line 882 of file Dataset.h.
References shark::LabeledData< InputT, LabelT >::elements().
|
inline |
|
inline |
Two containers compare equal if they share the same data.
Definition at line 152 of file Dataset.h.
References shark::Data< Type >::m_data.
|
inline |
Definition at line 309 of file Dataset.h.
References shark::Data< Type >::batch(), and shark::Data< Type >::m_data.
Referenced by shark::LabeledData< InputT, LabelT >::push_back().
|
inline |
Definition at line 725 of file Dataset.h.
References shark::LabeledData< InputT, LabelT >::batch(), and shark::LabeledData< InputT, LabelT >::push_back().
|
inline |
Definition at line 717 of file Dataset.h.
References shark::LabeledData< InputT, LabelT >::inputs(), shark::LabeledData< InputT, LabelT >::labels(), shark::LabeledData< InputT, LabelT >::m_data, shark::LabeledData< InputT, LabelT >::m_label, and shark::Data< Type >::push_back().
Referenced by shark::LabeledData< InputT, LabelT >::push_back().
void shark::blas::randomRotationMatrix | ( | random::rng_type & | rng, |
matrix_container< MatrixT, cpu_tag > & | matrixC | ||
) |
Initializes a matrix such that it forms a random rotation matrix.
The matrix needs to be quadratic and have the proper size (e.g. call matrix::resize before).
One common way to do this is using Gram-Schmidt-Orthogonalisation on a matrix which is initialized with gaussian numbers. However, this is highly unstable for big matrices.
This algorithm is implemented from one of the algorithms presented in Francesco Mezzadri "How to generate random matrices from the classical compact groups" http://arxiv.org/abs/math-ph/0609050v2
He gives two algorithms: the first one uses QR decomposition on the random gaussian matrix and ensures that the signs of Q are correct by multiplying every column of Q with the sign of the diagonal of R.
We use another algorithm implemented in the paper which works similarly, but reversed. We apply Householder rotations H_N H_{N-1}..H_1 where H_1 is generated from a random vector on the n-dimensional unit sphere. this requires less operations and is thus preferable. Also only half the random numbers need to be generated
Definition at line 168 of file rotations.h.
References shark::blas::applyHouseholderOnTheLeft(), shark::random::gauss(), and SIZE_CHECK.
Referenced by shark::benchmarks::CIGTAB1::init(), shark::benchmarks::CIGTAB2::init(), shark::benchmarks::ELLI1::init(), shark::benchmarks::ELLI2::init(), shark::benchmarks::IHR1::init(), shark::benchmarks::IHR2::init(), shark::benchmarks::IHR3::init(), shark::benchmarks::IHR4::init(), shark::benchmarks::IHR6::init(), shark::benchmarks::RotatedObjectiveFunction::init(), and shark::blas::randomRotationMatrix().
RealMatrix shark::blas::randomRotationMatrix | ( | random::rng_type & | rng, |
size_t | size | ||
) |
Creates a random rotation matrix with a certain size using the random number generator rng.
Definition at line 198 of file rotations.h.
References shark::blas::randomRotationMatrix().
DataView< DatasetType >::batch_type shark::randomSubBatch | ( | DataView< DatasetType > const & | view, |
std::size_t | size | ||
) |
Creates a random batch of a given size.
view | the view from which the batch is to be created |
size | the size of the batch |
Definition at line 291 of file DataView.h.
References shark::partial_shuffle(), shark::DataView< DatasetType >::size(), and shark::subBatch().
DataView< DatasetType > shark::randomSubset | ( | DataView< DatasetType > const & | view, |
std::size_t | size | ||
) |
creates a random subset of a DataView with given size
view | the view for which the subset is to be created |
size | the size of the subset |
Definition at line 263 of file DataView.h.
References shark::partial_shuffle(), shark::DataView< DatasetType >::size(), and shark::subset().
Referenced by main().
|
inlinevirtual |
Read the component from the supplied archive.
[in,out] | archive | The archive to read from. |
Reimplemented from shark::ISerializable.
Definition at line 269 of file Dataset.h.
References shark::Data< Type >::m_data, and shark::Data< Type >::m_shape.
|
inlinevirtual |
from ISerializable
Reimplemented from shark::ISerializable.
Definition at line 678 of file Dataset.h.
References shark::LabeledData< InputT, LabelT >::m_data, and shark::LabeledData< InputT, LabelT >::m_label.
|
inline |
Reorders elements across batches.
Takes a vector of indices so that the ith element is moved to index[i]. This will create a temporary copy of the dataset and thus requires a double amount of memory compared to the original dataset during construction.
Definition at line 337 of file Dataset.h.
References shark::Data< Type >::batch(), shark::batchSize(), shark::Data< Type >::elements(), shark::Data< Type >::numberOfBatches(), and shark::Data< Type >::shape().
Referenced by shark::LabeledData< InputT, LabelT >::reorderElements().
|
inline |
Definition at line 756 of file Dataset.h.
References shark::LabeledData< InputT, LabelT >::m_data, shark::LabeledData< InputT, LabelT >::m_label, and shark::Data< Type >::reorderElements().
Referenced by shark::repartitionByClass(), and shark::LabeledData< InputT, LabelT >::shuffle().
|
inline |
Reorders the batch structure in the container to that indicated by the batchSizes vector.
After the operation the container will contain batchSizes.size() batchs with the i-th batch having size batchSize[i]. However the sum of all batch sizes must be equal to the current number of elements
Definition at line 318 of file Dataset.h.
References shark::Data< Type >::m_data.
Referenced by shark::LabeledData< InputT, LabelT >::repartition().
|
inline |
Reorders the batch structure in the container to that indicated by the batchSizes vector.
After the operation the container will contain batchSizes.size() batches with the i-th batch having size batchSize[i]. However the sum of all batch sizes must be equal to the current number of elements
Definition at line 737 of file Dataset.h.
References shark::LabeledData< InputT, LabelT >::m_data, shark::LabeledData< InputT, LabelT >::m_label, and shark::Data< Type >::repartition().
Referenced by shark::createCVSameSize(), and shark::repartitionByClass().
void shark::repartitionByClass | ( | LabeledData< I, unsigned int > & | data, |
std::size_t | batchSize = LabeledData<I,unsigned int>::DefaultBatchSize |
||
) |
reorders the dataset such, that points are grouped by labels
The elements are not only reordered but the batches are also resized such, that every batch only contains elements of one class. This method must be used in order to use binarySubproblem.
Definition at line 1053 of file Dataset.h.
References shark::batchSize(), shark::classSizes(), shark::LabeledData< InputT, LabelT >::elements(), shark::LabeledData< InputT, LabelT >::numberOfElements(), shark::LabeledData< InputT, LabelT >::reorderElements(), and shark::LabeledData< InputT, LabelT >::repartition().
Referenced by main().
T shark::safeExp | ( | T | x | ) |
Thresholded exp function, over- and underflow safe.
Replaces the value of exp(x) for numerical reasons by the a threshold value if it gets too large. Use it only, if there is no other way to get the function stable!
x | the exponent |
Definition at line 112 of file Math.h.
Referenced by shark::CrossEntropy< blas::vector< T, Device >, blas::vector< T, Device > >::eval().
T shark::safeLog | ( | T | x | ) |
Data< blas::vector< T > > shark::selectFeatures | ( | Data< blas::vector< T > > const & | data, |
FeatureSet const & | features | ||
) |
Creates a copy of a dataset selecting only a certain set of features.
Definition at line 1002 of file Dataset.h.
References shark::transform().
Referenced by shark::selectInputFeatures().
LabeledData< RealVector, T > shark::selectInputFeatures | ( | LabeledData< RealVector, T > const & | data, |
FeatureSet const & | features | ||
) |
Definition at line 1016 of file Dataset.h.
References shark::LabeledData< InputT, LabelT >::inputs(), shark::LabeledData< InputT, LabelT >::labels(), and shark::selectFeatures().
void shark::setColumn | ( | Data< RowType > & | data, |
std::size_t | columnID, | ||
RowType | newColumn | ||
) |
Definition at line 1137 of file Dataset.h.
References shark::dataDimension(), shark::Data< Type >::elements(), shark::Data< Type >::numberOfElements(), and SHARK_ASSERT.
|
inline |
Returns the shape of the elements in the dataset.
Definition at line 222 of file Dataset.h.
References shark::Data< Type >::m_shape.
|
inline |
Returns the shape of the elements in the dataset.
Definition at line 217 of file Dataset.h.
References shark::Data< Type >::m_shape.
Referenced by shark::bootstrap(), shark::createDataFromRange(), shark::importPGMSet(), shark::LabeledData< InputT, LabelT >::inputShape(), shark::WeightedLabeledData< InputT, LabelT >::inputShape(), shark::LabeledData< InputT, LabelT >::inputShape(), shark::WeightedLabeledData< InputT, LabelT >::inputShape(), shark::LabeledData< InputT, LabelT >::labelShape(), shark::WeightedLabeledData< InputT, LabelT >::labelShape(), shark::LabeledData< InputT, LabelT >::labelShape(), shark::WeightedLabeledData< InputT, LabelT >::labelShape(), main(), shark::Data< Type >::reorderElements(), shark::toGPU(), shark::toGPU(), shark::transform(), and shark::transform().
|
inline |
shuffles all elements in the entire dataset (that is, also across the batches)
Definition at line 473 of file Dataset.h.
References shark::random::globalRng, shark::Data< InputT >::numberOfElements(), and shark::Data< InputT >::reorderElements().
|
inline |
shuffles all elements in the entire dataset (that is, also across the batches)
Definition at line 762 of file Dataset.h.
References shark::random::globalRng, shark::LabeledData< InputT, LabelT >::numberOfElements(), and shark::LabeledData< InputT, LabelT >::reorderElements().
Referenced by shark::createCVSameSize(), main(), and main().
boost::enable_if< std::is_arithmetic< T >, T >::type shark::sigmoid | ( | T | x | ) |
Logistic function/logistic function.
Calculates the sigmoid function 1/(1+exp(-x)). The type must be arithmetic. For example float,double,long double, int,... but no custom Type.
Definition at line 95 of file Math.h.
Referenced by shark::CrossEntropy< unsigned int, OutputType >::evalDerivative(), shark::CrossEntropy< unsigned int, OutputType >::evalDerivative(), shark::CrossEntropy< unsigned int, OutputType >::evalDerivative(), shark::LogisticNeuron::evalInPlace(), shark::BinaryLayer::sufficientStatistics(), and shark::BipolarLayer::sufficientStatistics().
|
inline |
boost::enable_if< std::is_arithmetic< T >, T >::type shark::softPlus | ( | T | x | ) |
Numerically stable version of the function log(1+exp(x)).
Numerically stable version of the function log(1+exp(x)). This function is the integral of the famous sigmoid function. The type must be arithmetic. For example float,double,long double, int,... but no custom Type.
Definition at line 147 of file Math.h.
Referenced by shark::BinaryLayer::logMarginalize(), and shark::BipolarLayer::logMarginalize().
|
inline |
Splits the container into two independent parts. The front part remains in the container, the back part is returned.
Order of elements remain unchanged. The SharedVector is not allowed to be shared for this to work.
Definition at line 294 of file Dataset.h.
References shark::Data< Type >::batch(), shark::Data< Type >::m_data, and shark::Data< Type >::m_shape.
Referenced by shark::LabeledData< InputT, LabelT >::splice().
|
inline |
Splits the container in 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 465 of file Dataset.h.
References shark::Data< InputT >::batch(), shark::UnlabeledData< InputT >::m_data, shark::Data< InputT >::m_shape, and shark::Data< Type >::m_shape.
Referenced by shark::LabeledData< InputT, LabelT >::splice().
|
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 704 of file Dataset.h.
References shark::LabeledData< InputT, LabelT >::batch(), shark::LabeledData< InputT, LabelT >::LabeledData(), shark::LabeledData< InputT, LabelT >::m_data, shark::LabeledData< InputT, LabelT >::m_label, shark::Data< Type >::splice(), and shark::UnlabeledData< InputT >::splice().
Referenced by main().
DatasetT shark::splitAtElement | ( | DatasetT & | data, |
std::size_t | elementIndex | ||
) |
Removes the last part of a given dataset and returns a new split containing the removed elements.
For this operation, the dataset is not allowed to be shared.
data The dataset which should be splited
index the first element to be split
Definition at line 1029 of file Dataset.h.
References shark::batchSize(), and SIZE_CHECK.
|
inline |
Definition at line 286 of file Dataset.h.
References shark::Data< Type >::batch(), and shark::Data< Type >::m_data.
Referenced by shark::LabeledData< InputT, LabelT >::splitBatch().
|
inline |
Definition at line 695 of file Dataset.h.
References shark::LabeledData< InputT, LabelT >::batch(), shark::LabeledData< InputT, LabelT >::m_data, shark::LabeledData< InputT, LabelT >::m_label, and shark::Data< Type >::splitBatch().
SHARK_EXPORT_SYMBOL std::tuple< bool, std::string, std::string > shark::splitUrl | ( | std::string const & | url | ) |
Split a URL into its domain and resource parts.
Returns a std::tuple where the first element indicates whether a secure socket is used, the second one is the domain, and the third is the resource. With std::tie you can do pattern-matching: std::tie(https, domain, resource) = splitUrl(url); will fill the variables https, domain and resource.
|
inline |
Calculates x^2.
Definition at line 81 of file Math.h.
Referenced by shark::CMAChromosome::CMAChromosome(), shark::CMSA::eigenValues(), shark::HuberLoss::eval(), shark::SquaredHingeLoss::eval(), shark::SquaredLoss< OutputType, LabelType >::eval(), shark::benchmarks::Cigar::eval(), shark::benchmarks::CigarDiscus::eval(), shark::benchmarks::Ellipsoid::eval(), shark::benchmarks::Himmelblau::eval(), shark::benchmarks::Rosenbrock::eval(), shark::benchmarks::Schwefel::eval(), shark::benchmarks::CIGTAB1::eval(), shark::benchmarks::DTLZ1::eval(), shark::benchmarks::DTLZ2::eval(), shark::benchmarks::DTLZ3::eval(), shark::benchmarks::DTLZ4::eval(), shark::benchmarks::DTLZ5::eval(), shark::benchmarks::ELLI1::eval(), shark::benchmarks::ELLI2::eval(), shark::benchmarks::Fonseca::eval(), shark::benchmarks::GSP::eval(), shark::benchmarks::IHR2::eval(), shark::benchmarks::IHR4::eval(), shark::benchmarks::IHR6::eval(), shark::benchmarks::LZ1::eval(), shark::benchmarks::LZ2::eval(), shark::benchmarks::LZ3::eval(), shark::benchmarks::LZ4::eval(), shark::benchmarks::LZ5::eval(), shark::benchmarks::LZ6::eval(), shark::benchmarks::LZ7::eval(), shark::benchmarks::LZ8::eval(), shark::benchmarks::LZ9::eval(), shark::benchmarks::ZDT2::eval(), shark::benchmarks::ZDT4::eval(), shark::benchmarks::ZDT6::eval(), shark::TwoNormRegularizer< SearchPointType >::eval(), shark::benchmarks::Discus::eval(), shark::VariationalAutoencoderError< SearchPointType >::eval(), shark::HuberLoss::evalDerivative(), shark::SquaredHingeLoss::evalDerivative(), shark::benchmarks::Rosenbrock::evalDerivative(), shark::benchmarks::Rosenbrock::evalDerivative(), shark::VariationalAutoencoderError< SearchPointType >::evalDerivative(), shark::benchmarks::IHR1::hg(), shark::benchmarks::IHR2::hg(), shark::benchmarks::IHR3::hg(), shark::benchmarks::IHR6::hg(), shark::VDCMA::init(), shark::LMCMA::init(), shark::PointSearch::init(), shark::kMeans(), shark::NSGA3Indicator::leastContributors(), shark::GaussianLayer::logMarginalize(), shark::GaussianLayer::logProbability(), shark::TanhNeuron::multiplyDerivative(), shark::FastSigmoidNeuron::multiplyDerivative(), shark::HMGSelectionCriterion::operator()(), shark::HypervolumeApproximator::operator()(), shark::KDTree< InputT >::squaredDistanceLowerBound(), shark::statistics::Variance::statistics(), shark::Adam< SearchPointType >::step(), shark::KernelMeanClassifier< InputType >::train(), shark::ARDKernelUnconstrained< InputType >::weightedParameterDerivative(), and shark::WeightedSumKernel< InputType >::weightedParameterDerivative().
DataView< DatasetType >::batch_type shark::subBatch | ( | DataView< DatasetType > const & | view, |
IndexRange const & | indizes | ||
) |
Creates a batch given a set of indices.
view | the view from which the batch is to be created |
indizes | the set of indizes defining the batch |
Definition at line 275 of file DataView.h.
References shark::createBatch(), and shark::subset().
Referenced by shark::RFClassifier< LabelType >::computeFeatureImportances(), shark::createCVFullyIndexed(), shark::createCVIndexed(), and shark::randomSubBatch().
DataView< DatasetType > shark::subset | ( | DataView< DatasetType > const & | view, |
IndexRange const & | indizes | ||
) |
Creates a subset of a DataView with elements indexed by indices.
view | the view for which the subset is to be created |
indizes | the index of the elements to be stored in the view |
Definition at line 253 of file DataView.h.
Referenced by shark::LooError< ModelTypeT, LabelType >::eval(), shark::Data< Type >::indexedSubset(), shark::Data< Type >::indexedSubset(), main(), shark::randomSubset(), shark::KernelExpansion< InputType >::sparsify(), and shark::subBatch().
DataView< T >::dataset_type shark::toDataset | ( | DataView< T > const & | view, |
std::size_t | batchSize = DataView<T>::dataset_type::DefaultBatchSize |
||
) |
Creates a new dataset from a View.
When the elements of a View needs to be processed repeatedly it is often better to use the packed format of the Dataset again, since then the faster batch processing can be used
view | the view from which to create the new dataset |
batchSize | the size of the batches in the dataset |
Definition at line 320 of file DataView.h.
References shark::batchSize(), shark::DataView< DatasetType >::begin(), shark::DataView< DatasetType >::end(), and shark::DataView< DatasetType >::size().
Referenced by shark::LooError< ModelTypeT, LabelType >::eval(), main(), and shark::KernelExpansion< InputType >::sparsify().
Data< blas::vector< Type, blas::gpu_tag > > shark::toGPU | ( | Data< blas::vector< T, blas::cpu_tag > > const & | data | ) |
Transfers a dataset from CPU to the GPU/OpenCL device.
Definition at line 49 of file DeviceSupport.h.
References shark::Data< Type >::batch(), and shark::Data< Type >::shape().
Data< blas::vector< Type, blas::gpu_tag > > shark::toGPU | ( | Data< unsigned int > const & | data | ) |
Transfers a dataset from CPU to the GPU/OpenCL device.
class labels are converted to one-hot encoding with a given Type
Definition at line 62 of file DeviceSupport.h.
References shark::Data< Type >::batch(), shark::Data< Type >::numberOfBatches(), shark::numberOfClasses(), and shark::Data< Type >::shape().
LabeledData< blas::vector< Type, blas::gpu_tag >, blas::vector< Type, blas::gpu_tag > > shark::toGPU | ( | LabeledData< I, L > const & | data | ) |
Transfers a labeled dataset from CPU to the GPU/OpenCL device.
Definition at line 79 of file DeviceSupport.h.
References shark::LabeledData< InputT, LabelT >::inputs(), and shark::LabeledData< InputT, LabelT >::labels().
DataView< DatasetType > shark::toView | ( | DatasetType & | set | ) |
Creates a View from a dataset.
This is just a helper function to omit the actual type of the view
set | the dataset from which to create the view |
Definition at line 307 of file DataView.h.
Referenced by shark::KernelExpansion< InputType >::sparsify().
boost::lazy_enable_if< CanBeCalled< Functor, typenameData< T >::batch_type >, TransformedData< Functor, T > >::type shark::transform | ( | Data< T > const & | data, |
Functor const & | f | ||
) |
Transforms a dataset using a Functor f and returns the transformed result.
this version is used, when the Functor supports batch-by-batch transformations
Definition at line 971 of file Dataset.h.
References shark::Data< Type >::batch(), shark::Data< Type >::numberOfBatches(), shark::Data< Type >::shape(), and SHARK_PARALLEL_FOR.
boost::lazy_disable_if< CanBeCalled< Functor, typenameData< T >::batch_type >, TransformedData< Functor, T > >::type shark::transform | ( | Data< T > const & | data, |
Functor | f | ||
) |
Transforms a dataset using a Functor f and returns the transformed result.
this version is used, when the Functor supports only element-by-element transformations
Definition at line 950 of file Dataset.h.
References shark::Data< Type >::batch(), shark::batchBegin(), shark::batchEnd(), shark::Data< Type >::numberOfBatches(), shark::Data< Type >::shape(), and SHARK_PARALLEL_FOR.
Referenced by main(), shark::AbstractModel< InputTypeT, OutputTypeT, ParameterVectorType >::operator()(), shark::selectFeatures(), shark::transformInputs(), and shark::transformLabels().
LabeledData< typename detail::TransformedDataElement< Functor, I >::type, L > shark::transformInputs | ( | LabeledData< I, L > const & | data, |
Functor const & | f | ||
) |
Transforms the inputs of a dataset and return the transformed result.
Definition at line 988 of file Dataset.h.
References shark::LabeledData< InputT, LabelT >::inputs(), shark::LabeledData< InputT, LabelT >::labels(), and shark::transform().
Referenced by shark::SvmLogisticInterpretation< InputType >::eval(), main(), and run_one_trial().
LabeledData< I, typename detail::TransformedDataElement< Functor, L >::type > shark::transformLabels | ( | LabeledData< I, L > const & | data, |
Functor const & | f | ||
) |
Transforms the labels of a dataset and returns the transformed result.
Definition at line 995 of file Dataset.h.
References shark::LabeledData< InputT, LabelT >::inputs(), shark::LabeledData< InputT, LabelT >::labels(), and shark::transform().
Referenced by shark::binarySubProblem(), main(), main(), and shark::oneVersusRestProblem().
|
inline |
|
inline |
|
inline |
|
inline |
Construction with size and a single element.
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 |
|
inline |
|
inlinevirtual |
Write the component to the supplied archive.
[in,out] | archive | The archive to write to. |
Reimplemented from shark::ISerializable.
Definition at line 274 of file Dataset.h.
References shark::Data< Type >::m_data, and shark::Data< Type >::m_shape.
|
inlinevirtual |
from ISerializable
Reimplemented from shark::ISerializable.
Definition at line 684 of file Dataset.h.
References shark::LabeledData< InputT, LabelT >::m_data, and shark::LabeledData< InputT, LabelT >::m_label.
|
static |
|
protected |
data
Definition at line 133 of file Dataset.h.
Referenced by shark::Data< Type >::append(), shark::Data< Type >::batch(), shark::Data< Type >::batch(), shark::Data< Type >::empty(), shark::Data< Type >::getPartitioning(), shark::Data< Type >::indexedSubset(), shark::Data< Type >::indexedSubset(), shark::Data< Type >::makeIndependent(), shark::Data< Type >::numberOfBatches(), shark::Data< Type >::numberOfElements(), shark::Data< Type >::operator==(), shark::Data< Type >::push_back(), shark::Data< Type >::read(), shark::Data< Type >::repartition(), shark::Data< Type >::splice(), shark::Data< Type >::splitBatch(), and shark::Data< Type >::write().
|
protected |
Definition at line 777 of file Dataset.h.
Referenced by shark::LabeledData< InputT, LabelT >::append(), shark::LabeledData< InputT, LabelT >::batch(), shark::LabeledData< InputT, LabelT >::batch(), shark::LabeledData< InputT, LabelT >::empty(), shark::LabeledData< InputT, LabelT >::getPartitioning(), shark::LabeledData< InputT, LabelT >::indexedSubset(), shark::LabeledData< InputT, LabelT >::inputs(), shark::LabeledData< InputT, LabelT >::inputs(), shark::LabeledData< InputT, LabelT >::inputShape(), shark::LabeledData< InputT, LabelT >::inputShape(), shark::LabeledData< InputT, LabelT >::makeIndependent(), shark::LabeledData< InputT, LabelT >::numberOfBatches(), shark::LabeledData< InputT, LabelT >::numberOfElements(), shark::LabeledData< InputT, LabelT >::push_back(), shark::LabeledData< InputT, LabelT >::read(), shark::LabeledData< InputT, LabelT >::reorderElements(), shark::LabeledData< InputT, LabelT >::repartition(), shark::LabeledData< InputT, LabelT >::splice(), shark::LabeledData< InputT, LabelT >::splitBatch(), and shark::LabeledData< InputT, LabelT >::write().
|
protected |
point data
Definition at line 778 of file Dataset.h.
Referenced by shark::LabeledData< InputT, LabelT >::append(), shark::LabeledData< InputT, LabelT >::batch(), shark::LabeledData< InputT, LabelT >::batch(), shark::LabeledData< InputT, LabelT >::indexedSubset(), shark::LabeledData< InputT, LabelT >::labels(), shark::LabeledData< InputT, LabelT >::labels(), shark::LabeledData< InputT, LabelT >::labelShape(), shark::LabeledData< InputT, LabelT >::labelShape(), shark::LabeledData< InputT, LabelT >::makeIndependent(), shark::LabeledData< InputT, LabelT >::push_back(), shark::LabeledData< InputT, LabelT >::read(), shark::LabeledData< InputT, LabelT >::reorderElements(), shark::LabeledData< InputT, LabelT >::repartition(), shark::LabeledData< InputT, LabelT >::splice(), shark::LabeledData< InputT, LabelT >::splitBatch(), and shark::LabeledData< InputT, LabelT >::write().
|
protected |
shape of a datapoint
Definition at line 134 of file Dataset.h.
Referenced by shark::Data< Type >::indexedSubset(), shark::Data< Type >::read(), shark::Data< Type >::shape(), shark::Data< Type >::shape(), shark::Data< Type >::splice(), shark::UnlabeledData< InputT >::splice(), and shark::Data< Type >::write().
|
static |
Constant for sqrt( 2 * pi ).
Definition at line 65 of file Math.h.
Referenced by shark::GaussianLayer::logMarginalize().
|
friend |